^$IsUppercase really means NotLowercase

I found something interesting the other day … non-uppercase characters were testing positive for ^$IsUppercase. While you might presume only an uppercase character/string would test positive for this, it is actually testing to be sure there are no lower-case alphabetic characters. The opposite is also true with ^$IsLowercase testing for Not Uppercase. So you first need to be sure you don’t have either a number or a non-alphabetic character if that is important before using either ^$IsUppercase or ^$IsLowercase

Testing the ^$IsUppercase function:

; by don at htmlfixit.com
; any-non lowercase non-alphabetic
; character tests positive as Uppercase
^!SetArray %Original%="0";"1";"|";"?";"a";"@";"1";"+";"=";"F";"`";"~";"-";"q";"L";"[";"}";" ";"x"
^!Set %count%=0
:Loop
^!Inc %count%
^!If "^%count%" > "^%Original0%" End

^!If "^$IsUppercase("^%Original^%count%%")$" = "1" UPPER ELSE NOTUPPER

:UPPER
^!Info "^%Original^%count%%" is POSITIVE when tested as upper case -- even if it isn't a letter
^!GoTo Loop

:NOTUPPER
^!Info "^%Original^%count%%" is negative when tested as upper case
^!GoTo Loop

Testing the ^$IsLowercase function:

; by don at htmlfixit.com
; any-non lowercase non-alphabetic
; character tests positive as Uppercase
^!SetArray %Original%="0";"1";"|";"?";"a";"@";"1";"+";"=";"F";"`";"~";"-";"q";"L";"[";"}";" ";"x"
^!Set %count%=0
:Loop
^!Inc %count%
^!If "^%count%" > "^%Original0%" End

^!If "^$IsLowercase("^%Original^%count%%")$" = "1" UPPER ELSE NOTUPPER

:UPPER
^!Info "^%Original^%count%%" is POSITIVE when tested as lower case -- even if it isn't a letter
^!GoTo Loop

:NOTUPPER
^!Info "^%Original^%count%%" is negative when tested as lower case
^!GoTo Loop

Leave a Reply

Recent Posts

Archives

Topics