09.02.2011, 20:03
Explode
By Pghpunkid
Description
This function does the same as the one you would find in PHP.
Examples
This would output:
--
This would output:
Parameters
explode(string[],delim[],result[][],maxsplit=0)
string[] - Your string you wish to explode.
delim[] - a string of which you wish to split your string up by. (Think of it as where you need to break it.)
result[][] - 2-Dimensional array, where the result will be stored.
maxsplit - Number of times you want to break the string. (Optional)
There are 2 more, but they are just fail-safes and get the sizes of result to prevent buffer overflow.
Notes
This is only 1 function, 1 include.. however i feel it deserves to be an include, otherwise it will be like strtok where you constantly have to hunt through old scripts to copy/paste the function.
Download Include and Filterscript
This was an idea i came up with in the shower.. i come up with some of my best ideas there.
Thanks for helping Slice.
By Pghpunkid
Description
This function does the same as the one you would find in PHP.
Examples
pawn Code:
new newload[10][32];
explode("This is a string"," ",newload);
printf("%s-%s-%s-%s",newload[0],newload[1],newload[2],newload[3]);
pawn Code:
This-is-a-string
pawn Code:
new newload[10][32];
explode("/command Integer string goes here."," ",newload,2);
printf("%s-%s-%s",newload[0],newload[1],newload[2]);
pawn Code:
/command-Integer-string goes here
explode(string[],delim[],result[][],maxsplit=0)
string[] - Your string you wish to explode.
delim[] - a string of which you wish to split your string up by. (Think of it as where you need to break it.)
result[][] - 2-Dimensional array, where the result will be stored.
maxsplit - Number of times you want to break the string. (Optional)
There are 2 more, but they are just fail-safes and get the sizes of result to prevent buffer overflow.
Notes
This is only 1 function, 1 include.. however i feel it deserves to be an include, otherwise it will be like strtok where you constantly have to hunt through old scripts to copy/paste the function.
Download Include and Filterscript
This was an idea i came up with in the shower.. i come up with some of my best ideas there.
Thanks for helping Slice.