string "{ 123, 456, 789 }" -> array etc

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
nevalon
Neophyte Poster
Posts: 39
Joined: Tue Mar 07, 2006 7:28 am

string "{ 123, 456, 789 }" -> array etc

Post by nevalon »

Is there any simple way to do it? Or the only way via SplitWords and CInts etc?
Zoram
New User
Posts: 5
Joined: Sun Aug 05, 2007 3:50 am

Post 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
nevalon
Neophyte Poster
Posts: 39
Joined: Tue Mar 07, 2006 7:28 am

Post by nevalon »

No, i need to transform exactly string into array. It'll be a administrator's tool, that string will be written ingame.
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

Post 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]
coltain
Grandmaster Poster
Posts: 159
Joined: Tue Mar 20, 2007 7:17 am

Post 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]
nevalon
Neophyte Poster
Posts: 39
Joined: Tue Mar 07, 2006 7:28 am

Post 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 :-)
Post Reply