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
darkspot
Apprentice


Joined: 29 Jul 2002
Posts: 105

PostPosted: Thu Nov 03, 2005 4:34 am   

Truncating a String List
 
Is there some command to truncate a string list?

Easiest thing I can think of is
Code:

#if (%numitems( @stringlist) > @truncatespot) {#for 1,%eval( %numitems( @stringlist)-@truncatespot) {#delnitem stringlist {%eval( @truncatespot+1)}}}


is there something easier?
the stuff before and after the truncate could be large number of items in the string list, so I guess I'm just looking for something more effecient.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Thu Nov 03, 2005 4:41 pm   
 
You could try this (which is a little shorter to type)

Code:

#WHILE (%numitems( @stringlist) > @truncatespot) { #delnitem stringlist %eval(@truncatespot+1) }


or this (which should run quicker)

Code:

#VAR Unique "~~-k-k-~~"
#NOOP %replaceitem(@Unique,@truncatespot,@stringlist)
#NOOP %match( %expandlist(@stringlist," ?? ") , "(*)@Unique*",@stringlist)
#NOOP %replace(@stringlist," ?? ","|")
_________________
Asati di tempari!
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