SA-MP Forums Archive
Foreach through 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: Foreach through lines. (/showthread.php?tid=480209)



Foreach through lines. - CriticalRP - 09.12.2013

In PHP it goes like
PHP код:
foreach(preg_split("/((\r?\n)|(\r\n?))/"$input) as $line
Is that possible to do with PAWN? If yes, please explain and give examples.

Thank you.


Re: Foreach through lines. - Emmet_ - 09.12.2013

You can, using the regular expression plugin:

https://sampforum.blast.hk/showthread.php?tid=247893

However, I don't think you can iterate by line with foreach. You'll have to perform a complex operation with loops and such, however I do believe that I have a string line iteration function somewhere on my PC.


Re: Foreach through lines. - CriticalRP - 09.12.2013

It would be helpful and I hope to find the exact solution for that problem, I am actually trying to get content from MySQL tables and seperate it by lines.


Re: Foreach through lines. - CriticalRP - 10.12.2013

Bump.