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


Joined: 26 Oct 2004
Posts: 1

PostPosted: Tue Oct 26, 2004 9:14 pm   

Padding values with spaces
 
I am trying to get an output in a window to be nicely formatted. I basically have 2 different variables that I concatenate together to get them to be on the same line, and then start a new line for the next set. I have 2 variables that are storing string as a String List.

I want the second variable to start its output starting at column 30, so what i was trying to do is output line number 1, then i wanted to try to do something like
Code:
#MATH padlen 30-%len(%1)
  ;find a way to add @padlen spaces to variable padding
%concat(@padding,%2)

That way all of %1 will be starting at the same place and %2 will be aligned 30 "spaces" from the start.

So what im asking is how i can either:
1] Dynamically add spaces to that variable
2] Have a cleaner/easier way in order to get my output to be matched up nicely (like an excel file)

Thanks
Reply with quote
Serentus
Apprentice


Joined: 28 Sep 2001
Posts: 103
Location: USA

PostPosted: Wed Oct 27, 2004 4:06 am   
 
You could try the %format() function.

%format("&-30s&-s",%1,%2)

should do what you want.
_________________
-Serentus-
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Wed Oct 27, 2004 4:57 am   
 
You might try searching the finished scripts forum. Iirc, Charbal made a script for neatly aligning things.
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