Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Sat Mar 08, 2008 9:23 pm   

Concatenating blanks at the beginning of a string.
 
I would like to understand why the following:
Code:

$day = %concat(" ",%right($day,1))

does not prefix the string with a blank. The string has "08" in it and I want to turn it into " 8". But the above code will return "8". Now I am doing further concatantions so it could all be lost in the process. Still, for whatever reason, the blank is being edited.
The final concatenation looks as follows:
Code:

timestamp = %concat($dow," ",$mon," ",$day)

So @timestamp should contain "Sat Mar 8", but no matter what I do it always contains "Sat Mar 8".

EDIT: I just looked at the result here. It does the same! There should be 2 blanks in 'contain "..."' after "Mar" but even here it shows as one space...
So it seems that a rule that says "let's compact all blanks between two non-blank characters to the minimum" is effect, and that this forum editor and the Settings Editor are using the same routine.
Test... "x y" <--- It does it here, also. There should be two blanks between x and y.
_________________
Sic itur ad astra.
Reply with quote
wrym
Magician


Joined: 06 Jul 2007
Posts: 349
Location: The big palace, My own lil world

PostPosted: Sat Mar 08, 2008 9:53 pm   
 
Try using %char(32) instead of " " for spaces, in several cases, especialy at beginning of strings, cmud will eat spaces, but if you use the %char function they are added.
Reply with quote
JQuilici
Adept


Joined: 21 Sep 2005
Posts: 250
Location: Austin, TX

PostPosted: Sat Mar 08, 2008 10:05 pm   Re: Concatenating blanks at the beginning of a string.
 
Anaristos wrote:
So it seems that a rule that says "let's compact all blanks between two non-blank characters to the minimum" is effect, and that this forum editor and the Settings Editor are using the same routine.
Test... "x y" <--- It does it here, also. There should be two blanks between x and y.

It's not the forum doing it...it's your web browser. Try quoting your own post to see. Wink
_________________
Come visit Mozart Mud...and tell an imm that Aerith sent you!
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Sat Mar 08, 2008 10:14 pm   
 
I understand what you are saying. That doesn't explain why it is happening also in the Settings Editor. There is no intermidiary web browser in that situation.
Either the string variable was compacted or %concat does not insert blanks if the subject string already begins with one.
_________________
Sic itur ad astra.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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