SA-MP Forums Archive
Split a string - dynamic - 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 a string - dynamic (/showthread.php?tid=473007)



Split a string - dynamic - Leenert - 31.10.2013

Hey guys,
i have a little problem. I have a string and want to split it. But I don't know, how long the string is and how many delimiter exist. So the string can be: "a-b-c-d-e" (delimiter is '-') or "a-b-c" or "a-b-c-d". I think you know what I mean.
Is there any possibility to split the string "dynamicly" into an array?


Re: Split a string - dynamic - Jefff - 01.11.2013

Yes, use sscanf and optional values