Convert a character to ASCII lower case.
Unlike the standard C library tolower function, this only recognizes standard ASCII letters and ignores the locale, returning all non-ASCII characters unchanged, even if they are lower 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 uchar before passing a possibly non-ASCII character in.
Example: Convert a character to lower case:
public static int main (string[] args) {
// Output: ``aa1 !``
print ("%c", 'A'.tolower ());
print ("%c", 'a'.tolower ());
print ("%c", '1'.tolower ());
print ("%c", ' '.tolower ());
print ("%c", '!'.tolower ());
print ("%c", '\n'.tolower ());
return 0;
}
valac --pkg glib-2.0 char.tolower.vala
c |
any character |
the result of converting |