[Include] Explode
#1

Explode
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]);
This would output:
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]);
This would output:
pawn Code:
/command-Integer-string goes here
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.
Reply


Messages In This Thread
Explode - by Pghpunkid - 09.02.2011, 20:03
Re: Explode - by Ash. - 09.02.2011, 20:04
Re: Explode - by TheAlienForce - 09.02.2011, 20:05
Re: Explode - by Pghpunkid - 09.02.2011, 20:06
Re: Explode - by RyDeR` - 09.02.2011, 20:38
Re: Explode - by Pghpunkid - 09.02.2011, 21:53
Respuesta: Explode - by anonymousx - 11.02.2011, 05:34
Re: Explode - by Pghpunkid - 11.02.2011, 08:24
Re: Explode - by Calgon - 11.02.2011, 08:31
Re: Explode - by Pghpunkid - 11.02.2011, 08:34
Re: Explode - by iMonk3y - 11.02.2011, 09:30
Re: Explode - by [M.A]Angel[M.A] - 11.02.2011, 13:28
Re: Explode - by Donya - 05.07.2011, 23:13
Re: Explode - by Pghpunkid - 05.09.2011, 09:24
Respuesta: Re: Explode - by CTCCoco - 31.07.2012, 12:42

Forum Jump:


Users browsing this thread: 1 Guest(s)