Skip to content
CShift0.32

Char

Classifying and converting characters (ASCII), like System.Char in C#:

if (Char.IsDigit(c))
value = value * 10 + (c - '0');

A char is a byte of UTF-8 text: the functions only know the ASCII characters; every byte above 127 is neither a letter nor a digit.

Name Description
IsDigit Whether c is a decimal digit (0 to 9).
IsUpper Whether c is an uppercase ASCII letter (A to Z).
IsLower Whether c is a lowercase ASCII letter (a to z).
IsLetter Whether c is an ASCII letter.
IsLetterOrDigit Whether c is an ASCII letter or a decimal digit.
IsHexDigit Whether c is a hexadecimal digit (0 to 9, a to f, A to F).
IsWhiteSpace Whether c is white space: a space, a tab, a line break (\n, \r), a vertical tab or a form feed.
ToUpper c as an uppercase letter; any other character stays as it is.
ToLower c as a lowercase letter; any other character stays as it is.
HexValue The value of a hexadecimal digit (0 to 15).
bool IsDigit(char c)

Whether c is a decimal digit (0 to 9).

bool IsUpper(char c)

Whether c is an uppercase ASCII letter (A to Z).

bool IsLower(char c)

Whether c is a lowercase ASCII letter (a to z).

bool IsLetter(char c)

Whether c is an ASCII letter.

bool IsLetterOrDigit(char c)

Whether c is an ASCII letter or a decimal digit.

bool IsHexDigit(char c)

Whether c is a hexadecimal digit (0 to 9, a to f, A to F).

bool IsWhiteSpace(char c)

Whether c is white space: a space, a tab, a line break (\n, \r), a vertical tab or a form feed.

char ToUpper(char c)

c as an uppercase letter; any other character stays as it is.

char ToLower(char c)

c as a lowercase letter; any other character stays as it is.

int HexValue(char c)

The value of a hexadecimal digit (0 to 15).

Returns -1 if c is not a hexadecimal digit.