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
Turkey_March
Newbie


Joined: 18 Apr 2007
Posts: 3

PostPosted: Wed Apr 18, 2007 11:32 am   

How do I access the nth character of a string?
 
Say I have the variable

#VAR Example {Hello world}

and I want to #SAY whatever the seventh character is ("w", in this case). What's the easiest way to do this? Looking at the documentation, it's possible to copy Example to a temporary variable, %delete the first six characters, and then call the %left function, but this seems like a waste of CPU cycles.
Reply with quote
Zwartje
Novice


Joined: 08 Feb 2007
Posts: 45

PostPosted: Wed Apr 18, 2007 11:45 am   
 
This should do the trick:

#SHOW %copy("Hello world",7,1)
Reply with quote
Turkey_March
Newbie


Joined: 18 Apr 2007
Posts: 3

PostPosted: Wed Apr 18, 2007 11:50 am   
 
That's what I was looking for, thank you.
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