Toupper
toupper
converts the lower case letters in a string into upper case letters. Other characters remain unchanged.
Syntax
toupper(STRING_EXPR)
STRING_EXPR
is an expression returning a string or a CLOB variable.
Examples
# Let's convert lowercase to uppercase
IRRITATED_MESSAGE=toupper("please be quiet!") : # Returns "PLEASE BE QUIET!"
# Let's compare strings independently from the case
If toupper(NAME_1) = toupper(NAME_2)
# The two names are identical
Endif
# Let's compare strings independently from the case and the accents
If toupper(ctrans(NAME_1)) = toupper(ctrans(NAME_2))
# The two names are identical
Endif
# Let's do it with a (French) accentuated message
IRRITATED_MESSAGE=toupper("s'il vous plaît, arrêtez ce bruit ô combien insensé")
# returns "S'IL VOUS PLAÎT, ARRÊTEZ CE BRUIT Ô COMBIEN INSENSÉ"
Description
toupper
converts the lower case characters (including the accentuated letters) in the corresponding upper case characters, without changing other characters.
The function ctrans can be used to suppress the accents prior to using the toupper function.
The type of result is Char or Clbfile, depending on the length of the string.
Comments
The format$ used with a format that contains only "A", will also perform a toupper
conversion, with the following differences:
* The length of the resulting string will be constant and can include trailing spaces.
* If characters that are not letters are present, the formatting will globally replace the string by a string filled with spaces. This will happen for accentuated characters that are refused by the "A" format.
Associated errors
Error code | Description |
---|---|
10 | The argument is not a string or CLOB. |