|
hezukeh Beginner
Joined: 24 Sep 2004 Posts: 14
|
Posted: 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 |
|
|
|
hezukeh Beginner
Joined: 24 Sep 2004 Posts: 14
|
Posted: 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.
|
|
|
|
Rorso Wizard
Joined: 14 Oct 2000 Posts: 1368
|
Posted: Fri Sep 24, 2004 8:32 pm |
Try:
%concat(%repeat("=", 5), "test") |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: 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 |
|
|
|
hezukeh Beginner
Joined: 24 Sep 2004 Posts: 14
|
Posted: Sat Sep 25, 2004 8:34 pm |
nice ty
|
|
|
|
|
|