View unanswered posts | View active topics
|
Page 1 of 1
|
[ 6 posts ] |
|
| Author |
Message |
|
nevalon
|
Post subject: string "{ 123, 456, 789 }" -> array etc Posted: Wed Sep 05, 2007 7:17 am |
|
Joined: Tue Mar 07, 2006 7:28 am Posts: 39 Location: Poland
|
|
Is there any simple way to do it? Or the only way via SplitWords and CInts etc?
_________________ Sorry for my English... I don't know it well.
|
|
| Top |
|
 |
|
Zoram
|
Post subject: Posted: Wed Sep 05, 2007 3:25 pm |
|
Joined: Sun Aug 05, 2007 3:50 am Posts: 6 Location: Heart of Dixie
|
|
| Top |
|
 |
|
nevalon
|
Post subject: Posted: Wed Sep 05, 2007 3:36 pm |
|
Joined: Tue Mar 07, 2006 7:28 am Posts: 39 Location: Poland
|
|
No, i need to transform exactly string into array. It'll be a administrator's tool, that string will be written ingame.
_________________ Sorry for my English... I don't know it well.
|
|
| Top |
|
 |
|
Austin
|
Post subject: Posted: Wed Sep 05, 2007 4:01 pm |
|
 |
| POL Developer |
 |
Joined: Wed Jan 25, 2006 2:30 am Posts: 410 Location: San Diego, California
|
|
096 and 097
[code]
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]
_________________ -Austin
|
|
| Top |
|
 |
|
coltain
|
Post subject: Posted: Thu Sep 06, 2007 6:17 am |
|
Joined: Tue Mar 20, 2007 7:17 am Posts: 99 Location: Poland
|
|
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]
|
|
| Top |
|
 |
|
nevalon
|
Post subject: Posted: Thu Sep 06, 2007 2:41 pm |
|
Joined: Tue Mar 07, 2006 7:28 am Posts: 39 Location: Poland
|
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 
_________________ Sorry for my English... I don't know it well.
|
|
| Top |
|
 |
|
Page 1 of 1
|
[ 6 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 0 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|