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
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Mon Apr 28, 2008 1:57 am   

[CMUD 2.18]The trouble with %proper
 
%proper returns incorrect value if first character is not a letter.


EDIT: until it gets fixed this will do the job
Code:
#FUNC proper($string) {#RETURN %subregex($string,"^(\w)(.*)","%upper(%pat(1))%pat(2)")}
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Mon Apr 28, 2008 11:39 am   
 
It helps to give details on exactly what incorrect value is returned. I tried %proper("123abc") and it returned 23abc. (Oddly enough, it has the exact same behavior in zMUD.)
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Mon Apr 28, 2008 12:50 pm   
 
The fact that value its returning is not the correct value seemed sufficient.
It only has to be off by 1 to be broken.
I was certain Zugg could determine what was wrong given the information I originally provided.

But for the curious:
If the original first character is not a miniscule alphabetic character the ordinal value of the first character returned will be 32 less than the original
if this value falls below zero it loops around to 255 and decrements from there.

Code:
#echo %ascii(%proper("0"))

displays 16
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Apr 28, 2008 4:58 pm   
 
Added to bug list.
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