Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
wanghom8228
Newbie


Joined: 03 Jan 2006
Posts: 7

PostPosted: Thu Feb 08, 2007 3:43 pm   

How to convert a array to a text
 
is it possible to convert a arry to a text.
i mean if
#var str %array("a","b","c")
how i can get a text "a|b|c" from variable "str"

of couse , we can use a loop to do it.
but if there is a better way to solve it?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Feb 08, 2007 11:01 pm   
 
I assume you mean you want to have "a|b|c" = "abc"? That's the easy part:

%replace(A, B, C)

A = the original text to work with (this can be a literal string like "this is a test" or it can be a variable or function result)
B = the exact substring within A you want to look for (again, literal string, variable, or function result)
C = the exact substring you want to replace B (ditto)

The far harder thing to do is to make "abc" = "a|b|c". There's no simple function do this, so you are practically required to use a looping structure coupled with some combination of the %left/%right functions.

If all you want is to get "a", "b", or "c" from the variable, just use %item().
_________________
EDIT: I didn't like my old signature
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net