PenUltima Online

It is currently Sun Sep 07, 2008 2:27 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: string "{ 123, 456, 789 }" -> array etc
PostPosted: Wed Sep 05, 2007 7:17 am 
Offline

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
 Profile  
 
 Post subject:
PostPosted: Wed Sep 05, 2007 3:25 pm 
Offline
User avatar

Joined: Sun Aug 05, 2007 3:50 am
Posts: 6
Location: Heart of Dixie
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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 05, 2007 3:36 pm 
Offline

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
 Profile  
 
 Post subject:
PostPosted: Wed Sep 05, 2007 4:01 pm 
Offline
POL Developer
User avatar

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
 Profile  
 
 Post subject:
PostPosted: Thu Sep 06, 2007 6:17 am 
Offline

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
 Profile  
 
 Post subject:
PostPosted: Thu Sep 06, 2007 2:41 pm 
Offline

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
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 8 hours


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

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl