Eddi пишет: string strka="123 4567 890";
int mass[3];//это string
SplitString(strka, #mass[0], " ");//Это char ' '
messagebox(format(mass[1]));
function SplitString(string str, string #outputmass, char delim){
int n=1;//Тут 0
char a[1024];
strcpy(#a[0], str);
int sp=1;//Тут 0
int size_a=size(#a[0]);
loop(size_a){
if (a[n]!=delim){outputmass[sp]=outputmass[sp]+a[n];}
if (a[n]==delim){sp++;outputmass[sp]=outputmass[sp]+a[n];}
n++;
}
}
CODE:string strka="123 4567 890";
string mass[3];
SplitString(strka, #mass[0], ' ');
messagebox(mass[0]);
function SplitString(string str, string #outputmass, char delim){
int n=0;
char a[1024];
strcpy(#a[0], str);
int sp=0;
int size_a=size(#a[0]);
outputmass[sp]="";
loop(size_a){
if (a[n]!=delim){outputmass[sp]=outputmass[sp]+a[n];}
if (a[n]==delim){sp++;outputmass[sp]="";}
n++;
}
} |