|
Dharkael Enchanter
Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: 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." |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: 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.)
|
|
|
|
Dharkael Enchanter
Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: 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." |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Apr 28, 2008 4:58 pm |
Added to bug list.
|
|
|
|
|
|