StrLower / StrUpper
From Auto Hotkey
StrLower / StrUpper
Converts a string to lowercase or uppercase.
OutputVar := StrLower(String , "T") OutputVar := StrUpper(String , "T")
Parameters
- OutputVar
The name of the variable in which to store the newly converted string.
- String
The string to convert.
- T
If this parameter is the letter T, the string will be converted to title case. For example, "GONE with the WIND" would become "Gone With The Wind".
Remarks
To detect whether a character or string is entirely uppercase or lowercase, use value is "upper"/"lower" or RegExMatch. For example:
var := "abc"
if var is "upper"
MsgBox "var is empty or contains only uppercase characters."
if var is "lower"
MsgBox "var is empty or contains only lowercase characters."
if RegExMatch(var, "^[a-z]+$")
MsgBox "var is not empty and contains only lowercase ASCII characters."
if !RegExMatch(var, "[A-Z]")
MsgBox "var does not contain any uppercase ASCII characters."
Format can also be used for case conversions, as shown below:
MsgBox Format("{:U}, {:L} and {:T}", "upper", "LOWER", "title")
Related
InStr, SubStr, StrLen, StrReplace
Example
String1 := StrUpper(String1) ; i.e. output can be the same as input.
String2 := StrLower("ABC") ; String2 now contains "abc"