Is there any way to split? - 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: Is there any way to split? (
/showthread.php?tid=651432)
Is there any way to split? -
Osamakurdi - 20.03.2018
In Python language there is function that called:
.split
What does this do is(if we have this sentence):
GG[80] = "HeyHeyHeyHeyHey"
so that function can split and give it:
GG[0] = "Hey"
GG[1] = "Hey"
GG[2] = "Hey"
etc...
Is there any way to do it in samp ?
Re: Is there any way to split? -
CantBeJohn - 20.03.2018
Nevermind, I misunderstood.
Re: Is there any way to split? -
Osamakurdi - 20.03.2018
Quote:
Originally Posted by CantBeJohn
|
Not this what I'm searching for...
Re: Is there any way to split? -
CantBeJohn - 20.03.2018
Quote:
Originally Posted by Osamakurdi
Not this what I'm searching for... 
|
The only function I could think of that’s like this would be:
https://sampwiki.blast.hk/wiki/Strmid
Re: Is there any way to split? -
Osamakurdi - 20.03.2018
Quote:
Originally Posted by CantBeJohn
|
Okay I need a function that split string every something for example I have this string:
"Hello * Man"
so if i use a function for example called split. so it can be used like:
split("Hello", *);
so its can give me 2 strings
first string is : Hello
seconds string is : MAN..
Re: Is there any way to split? -
ball - 20.03.2018
Read about sscanf.
Re: Is there any way to split? -
NaS - 20.03.2018
sscanf would be possible but isn't perfect as it expects a certain amount of Strings (split can operate on any amount of sub-strings within the limit (at least in PAWN there must be a limit)).
https://sampforum.blast.hk/showthread.php?tid=362764 - strlib by Slice
The function "strexplode" is what you are looking for. This Include also has a lot of other very useful string functions.