Split in sa-mp - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Split in sa-mp (
/showthread.php?tid=261582)
Split in sa-mp -
whitedragon - 14.06.2011
How to split string to array? Like nospace
.
Re: Split in sa-mp -
Calgon - 14.06.2011
@belhot1992: You should wrap code in the 'PAWN' BBCode tags.
@OP: You should consider using sscanf to split data, it's generally a lot more faster.
Re: Split in sa-mp -
Skaizo - 14.06.2011
Код:
forward split(const strsrc[], strdest[][], delimiter);//at the top script
public split(const strsrc[], strdest[][], delimiter)
{
new i, li;
new aNum;
new len;
while(i <= strlen(strsrc)){
if(strsrc[i]==delimiter || i==strlen(strsrc)){
len = strmid(strdest[aNum], strsrc, li, i, 128);
strdest[aNum][len] = 0;
li = i+1;
aNum++;
}
i++;
}
return 1;
}
Re: Split in sa-mp -
whitedragon - 14.06.2011
Hmm can some explan how i get Pcash to work
pawn Код:
new cash[128];
new cash2[9][64];
format(cash,128,"$00000000");
split2(cash, cash2, '|');
printf("%d",sizeof(cash2)); // <= i Get 9
new Pcash3[128];
format(Pcash3,128,"123");
new Pcash2[9][64];
split2(Pcash3, Pcash2, '|');
printf("%d",sizeof(Pcash2)); // <= i Get 9 to any idea why?