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.
Functions
Section titled “Functions”| 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). |
IsDigit
Section titled “IsDigit”bool IsDigit(char c)Whether c is a decimal digit (0 to 9).
IsUpper
Section titled “IsUpper”bool IsUpper(char c)Whether c is an uppercase ASCII letter (A to Z).
IsLower
Section titled “IsLower”bool IsLower(char c)Whether c is a lowercase ASCII letter (a to z).
IsLetter
Section titled “IsLetter”bool IsLetter(char c)Whether c is an ASCII letter.
IsLetterOrDigit
Section titled “IsLetterOrDigit”bool IsLetterOrDigit(char c)Whether c is an ASCII letter or a decimal digit.
IsHexDigit
Section titled “IsHexDigit”bool IsHexDigit(char c)Whether c is a hexadecimal digit (0 to 9, a to f, A to F).
IsWhiteSpace
Section titled “IsWhiteSpace”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.
ToUpper
Section titled “ToUpper”char ToUpper(char c)c as an uppercase letter; any other character stays as it is.
ToLower
Section titled “ToLower”char ToLower(char c)c as a lowercase letter; any other character stays as it is.
HexValue
Section titled “HexValue”int HexValue(char c)The value of a hexadecimal digit (0 to 15).
Returns -1 if c is not a hexadecimal digit.