1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| public void TransferMots(string texte)
{
int g = 1;
int f = 0;
char[] tabIndex = texte.ToCharArray();
for (int i = 1; i < (tabIndex.Length-1); i++)//crée le tableau d'index pour la séparation des mots
{
if (char.IsWhiteSpace(tabIndex[i])&( (char.IsLetter(tabIndex[i - 1]) & char.IsLetter(tabIndex[i + 1]))))
{
tabMot[f] = i;
f++;
tabMot[f] = i;
f++;
}
else if (char.IsWhiteSpace(tabIndex[i]) & (char.IsLetter(tabIndex[i - 1]) | char.IsLetter(tabIndex[i + 1])))//Reste a déterminer
{
tabMot[f] = i;
f++;
tabMot[f] = i;
f++;
}
}
for (int i = 0; i < 379; i++)//transpher les mots du string normaliser dans la liste......revoir les indexs,le 200 est temporaire
{
if (texte[i] == ' ')
{
dictio.Add(texte.Substring(tabMot[g], (tabMot[g + 1] - tabMot[g])));
g++;
g++;
}
}
} |
Partager