Page 1 of 1
string "{ 123, 456, 789 }" -> array etc
Posted: Wed Sep 05, 2007 7:17 am
by nevalon
Is there any simple way to do it? Or the only way via SplitWords and CInts etc?
Posted: Wed Sep 05, 2007 3:25 pm
by Zoram
Have a look at Racalac's eScript guide it might be what you are looking for.
Arrays are in Chapter 2a.
http://docs.polserver.com/pol096/escrip ... tml#chap2a
Posted: Wed Sep 05, 2007 3:36 pm
by nevalon
No, i need to transform exactly string into array. It'll be a administrator's tool, that string will be written ingame.
Posted: Wed Sep 05, 2007 4:01 pm
by Austin
096 and 097
Code: Select all
var string_example = "This is a string";
var string_array = SplitWords(string_example, " ");
//array contains {"this", "is", "a", "string"}
[code]
[code]
var string_example = "This is a string";
var string_array = SplitWords(string_example, "a");
//array contains {"this is ", " string"}
[code]
Posted: Thu Sep 06, 2007 6:17 am
by coltain
but the string look is {a, string, is, here}
splitwords(string,", ") gives an array {"{a","string","is","here}"}
so last thing to do is to get rid of the brackets in array[1] and array[last]
Posted: Thu Sep 06, 2007 2:41 pm
by nevalon
OK, I know how to do it via SplitWords(), but I asked for it because I couldn't find any function like CInt() for array - as I see I have to write it myself
