toupper


Description:

public char toupper ()

Convert a character to ASCII upper case.

If the character is not an ASCII lower case letter, it is returned unchanged.

Unlike the standard C library `toupper()` function, this only recognizes standard ASCII letters and ignores the locale, returning all non-ASCII characters unchanged, even if they are upper case letters in a particular character set. Also unlike the standard library function, this takes and returns a char, not an int, so don't call it on `EOF` but no need to worry about casting to `guchar` before passing a possibly non-ASCII character in.

Example: Convert a character to upper case:

public static int main (string[] args) {
// Output: ``AA1 !``
print ("%c", 'A'.toupper ());
print ("%c", 'a'.toupper ());
print ("%c", '1'.toupper ());
print ("%c", ' '.toupper ());
print ("%c", '!'.toupper ());
print ("%c", '\n'.toupper ());
return 0;
}

valac --pkg glib-2.0 char.toupper.vala

Parameters:

c

any character

Returns:

the result of the conversion