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
hezukeh
Beginner


Joined: 24 Sep 2004
Posts: 14

PostPosted: Fri Sep 24, 2004 7:48 pm   

padding
 
Ok so what is the function used in zMud that is equivilent to MM's @Pad(Right/Left)? If you don't know what I'm talking about, it's the function that allows you to pad one side of a string with a number of any one character. For instance: In MM, it would be @PadRight(test,"=",5) and it would show the following.

=====test
Reply with quote
hezukeh
Beginner


Joined: 24 Sep 2004
Posts: 14

PostPosted: Fri Sep 24, 2004 7:51 pm   
 
Err oops it's on the left side. :P But yeah you understand what I'm talking about.
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Fri Sep 24, 2004 8:32 pm   
 
Try:
%concat(%repeat("=", 5), "test")
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Sep 24, 2004 10:15 pm   
 
We will do better. A single function, that guesses which way you want to pad based on input lengths.

#FUNCTION Pad {%if(%len(%1)<%len(%2),%repeat("%1",%3)"%2","%1"%repeat("%2",%3))}

Usage:
#ECHO @Pad("abc","3",7)
Displays:
abc3333333

#ECHO @Pad("3","abc",7)
Displays:
3333333abc
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
hezukeh
Beginner


Joined: 24 Sep 2004
Posts: 14

PostPosted: Sat Sep 25, 2004 8:34 pm   
 
nice ty
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