SA-MP Forums Archive
split to two lines - 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)
+--- Thread: split to two lines (/showthread.php?tid=525441)



split to two lines - Hirsw0w - 11.07.2014

hey all,
i need your help in something i had this: new text[3000]
and that what i write in it...

1\n2\n3\n4\n
that example
and i want when has \n or \r that split it to two strings like
new string1[4],string2[4];

string1 was 1
and string2 was 2 and that with all 3 and 4...
and i need the smartest and the fastest way... and think i have a 100 - 300 lines in the file

thx for who can help me,
sorry for my bad english!!!!!


Re: split to two lines - ScripteRMKD - 12.07.2014

pawn Код:
new text1[150],text2[150],text3[150],text4[150];
If i help you give me rep +


Re: split to two lines - DeStunter - 12.07.2014

https://sampwiki.blast.hk/wiki/Strmid
https://sampwiki.blast.hk/wiki/Strfind

or you can use sscanf


Re: split to two lines - Hirsw0w - 12.07.2014

Quote:
Originally Posted by DeStunter
Посмотреть сообщение
you can tell me how to do that listen the text change that read that from file
you can give me example how to use.. thx.


Re: split to two lines - Hirsw0w - 12.07.2014

Quote:
Originally Posted by ******
Посмотреть сообщение
"fread" reads files line-by-line anyway.
I know that but i need that for something other and i needed and i dont want to do like this
new text[300(lines)][3000] I had a reason why i do that like that,
if you can explain that be good for me


Re: split to two lines - Hirsw0w - 13.07.2014

please someone help me!