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
Lasivian
Wanderer


Joined: 25 Jan 2002
Posts: 76
Location: USA

PostPosted: Fri Oct 16, 2009 5:25 pm   

How do I search a string list variable?
 
I've searched heavily and all I see is ways to search a database for a string, but not a string variable for a specific string.

I'm guessing there has to be a way to do this.

Thanks
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Oct 16, 2009 5:37 pm   
 
There's %ismember(), which is designed to return the element position of the data you are searching for, and there's %pos(), which is helpful for basic strings.

Each one returns a different result. If you wanted to %ismember("Joe","John|Joe|Jack") then the result would be 2, because "Joe" is the second item in the list. However, if you wanted to %pos("Joe","John|Joe|Jack"), then the result would be 6, because that's the character position where the string "Joe" starts.

There are other functions that do other things, too.
_________________
EDIT: I didn't like my old signature
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4689
Location: Pensacola, FL, USA

PostPosted: Mon Oct 19, 2009 6:59 pm   
 
%match is my favorite... its essentially a trigger in a function
_________________
Discord: Shalimarwildcat
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