Blitz3D+ Command Reference

Lower$ ( string$ )

Parameters

string - the string to convert

Description

Returns a copy of the string with every letter in lower case.

Lower is mostly about making comparisons forgiving. Blitz3D+ compares strings exactly, so "Yes" and "yes" are different values. Passing both sides through Lower first turns a fussy test into one that accepts whatever the player typed - handy for menu commands, cheat codes, chat commands and save-file keys.

It is also the safe way to compare file extensions and asset names, where the same file might be written as .PNG or .png depending on where it came from.

Only the plain A to Z letters are converted. Accented and other high-byte characters are left exactly as they are, so a name with an accent in it will not match its unaccented spelling however you case it.

See also: Upper, Trim, Instr, Replace.

Example

; Lower Example
; -------------

; Lower$ returns a copy of a string with every letter in lower case.

shout$="STOP SHOUTING IN CHAT!"
Print "Original: "+shout$
Print "Lower$:   "+Lower$(shout$)
Print ""

; Case-insensitive command check: lower both sides before comparing
typed$="StArT"
If Lower$(typed$)="start" Then
    Print "'"+typed$+"' matches the start command (compared in lower case)"
EndIf

; Digits and punctuation are left unchanged
Print "Lower$('COORDS: X=5, Y=10') = "+Lower$("COORDS: X=5, Y=10")

Print ""
Print "Press any key to close the example"
WaitKey

End

Index