Blitz3D+ Command Reference

Upper$ ( string$ )

Parameters

string - the string to convert

Description

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

Upper is the mirror of Lower, and it is used for the same two things: making comparisons case-insensitive, and shouting.

For comparisons it does not matter which of the two you pick, as long as you run both sides through the same one. Upper is the traditional choice when the text will also be displayed, since arcade high-score tables, menu headings and "GAME OVER" all look right in capitals.

Only the plain a to z letters are converted. Accented and other high-byte characters pass through untouched, so do not rely on Upper to normalise names from outside your program.

See also: Lower, Trim, Instr, Replace.

Example

; Upper Example
; -------------

; Upper$ returns a copy of a string with every letter in upper case.

name$="robo the rocketeer"
Print "Original: "+name$
Print "Upper$:   "+Upper$(name$)
Print ""

; Case-insensitive cheat-code check: upper both sides before comparing
typed$="BigHead"
If Upper$(typed$)="BIGHEAD" Then
    Print "'"+typed$+"' unlocked the BIGHEAD cheat (compared in upper case)"
EndIf

; Digits and punctuation are left unchanged
Print "Upper$('level-9 ready!') = "+Upper$("level-9 ready!")

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

End

Index