Yeah.. sorry, it's the first time that i'm writing on a page like that...
ok that's what i tried, it worked for quite all of them and i had a problem with only one..
it's one of my contrustor...
so while im searching in my string i'm looking first, if it's not a space then i'm putting in the good variable, then after, if the caracter it's a space, i'm gonna look if the caractor next to it (i+1) it,s a space to, then after if the caractor at i+2 is different then a space, so it's a different word... then i'll change variable with indice...
then if it's a but the space is include in the word like "BUENOS AIRES" ill right it down in my variable... but the problem then, it's for BRUNEI between BANDAR SERI BEGAWAN and 5770 there's only one space so BANDAR SERI BEGAWAN 5770 are only one variable... so there's where i'm stuck... i cant find a way to resolve the problem.
- public pays(string extrInfo)
-
{
-
int indice = 1;
-
continent = extrInfo[0];
-
for (int i = 1; i < extrInfo.Length; i++)
-
{
-
if (!(extrInfo[i] == ' '))
-
{
-
switch (indice)
-
{
-
case 1:
-
paysnom = paysnom + extrInfo[i];
-
break;
-
case 2:
-
capital = capital + extrInfo[i];
-
break;
-
case 3:
-
supercifie = supercifie + extrInfo[i];
-
break;
-
case 4:
-
population = population + extrInfo[i];
-
break;
-
}
-
if (extrInfo[i] == ' ' && (extrInfo[i + 1] == ' ') && !(extrInfo[i + 2] == ' '))
-
{
-
indice++;
-
}
-
else if (extrInfo[i] == ' ' && !(extrInfo[i + 1] == ' ') && !(extrInfo[i - 1] == ' '))
-
{
-
switch (indice)
-
{
-
case 1:
-
paysnom = paysnom + extrInfo[i];
-
break;
-
case 2:
-
capital = capital + extrInfo[i];
-
break;
-
case 3:
-
supercifie = supercifie + extrInfo[i];
-
break;
-
case 4:
-
population = population + extrInfo[i];
-
break;
-
}
-
}
-
-
}
-
}
-
}