Page 1 of 1

Game Editor Split string

PostPosted: Wed Nov 16, 2011 8:39 pm
by tzoli
Hi.
How can I split a string to array by a special character.(like explode() in PHP).
Exemple:
"6,6,6,6,6,6,
4,4,4,4,4,4,
4,4,4,4,4,4,
4,4,4,4,4,4,
4,4,4,4,4,4,
4,4,4,4,4,4,
4,4,4,4,4,4,
4,4,4,4,4,4,
4,4,4,4,4,4,
4,4,4,4,4,4"
to split with "," and get an array(ex. words) words[0] supposed to be 6 but words [6] supposed to be 4
Is there a solution?

Re: Game Editor Split string

PostPosted: Wed Nov 16, 2011 10:50 pm
by skydereign
From what you've posted, it sounds like you just want to remove the commas from the string. If you did that, then words[6] would be 4, while words[0] would be 6. Of course, unlike explode, you aren't dealing with an array of strings. So, you could manually break up the string into an array of strings or you can grab substrings from a normal string (using something like strncpy(text, &word[6], 6);).

Re: Game Editor Split string

PostPosted: Tue Nov 22, 2011 7:11 pm
by tzoli
Thanks

Re: Game Editor Split string

PostPosted: Fri Dec 02, 2011 8:55 pm
by tintran
2 functions in Global code called chrCount and explode
usage in Script: exploded -> Create Actor
I am curious in what you're trying to build with these functions.