Class Character
Provide methods to determine if specified character fall within certain character classes
public static class Character
- Inheritance
-
Character
- Inherited Members
Methods
IsAlpha(int)
Determines whether a character is alphabetical (a letter)
public static bool IsAlpha(int character)
Parameters
characterintThe character to check whether it's alphabetical
Returns
Remarks
WARNING: Regardless of the system locale, this will only treat ASCII values for English 0x41 ('A') through 0x5A ('Z') and 0x61 ('a') through 0x7A ('z') as true.
IsAlpha(Rune)
Determines whether a character rune is alphabetical (a letter)
public static bool IsAlpha(Rune rune)
Parameters
runeRuneThe character rune to check whether it's alphabetical
Returns
Remarks
WARNING: Regardless of the system locale, this will only treat ASCII values for English 0x41 ('A') through 0x5A ('Z') and 0x61 ('a') through 0x7A ('z') as true.
IsAlphaNumeric(int)
Determines whether a character is alphabetical (a letter) or numerical (a number digit)
public static bool IsAlphaNumeric(int character)
Parameters
characterintThe character to check whether it's alphabetical or numerical
Returns
Remarks
WARNING: Regardless of the system locale, this will only treat ASCII values for English 0x30 ('0') through 0x39 ('9'), 0x41 ('A') through 0x5A ('Z'), and 0x61 ('a') through 0x7A ('z') as true.
IsAlphaNumeric(Rune)
Determines whether a character rune is alphabetical (a letter) or numerical (a number digit)
public static bool IsAlphaNumeric(Rune rune)
Parameters
runeRuneThe character rune to check whether it's alphabetical or numerical
Returns
Remarks
WARNING: Regardless of the system locale, this will only treat ASCII values for English 0x30 ('0') through 0x39 ('9'), 0x41 ('A') through 0x5A ('Z'), and 0x61 ('a') through 0x7A ('z') as true.
IsBlank(int)
Determines whether a character is blank (a space or tab character)
public static bool IsBlank(int character)
Parameters
characterintThe character to check whether it's blank
Returns
Remarks
WARNING: Regardless of the system locale, this will only treat ASCII values 0x09 ('\t') or 0x20 (' ') as true.
IsBlank(Rune)
Determines whether a character rune is blank (a space or tab character)
public static bool IsBlank(Rune rune)
Parameters
runeRuneThe character rune to check whether it's blank
Returns
Remarks
WARNING: Regardless of the system locale, this will only treat ASCII values 0x09 ('\t') or 0x20 (' ') as true.
IsControl(int)
Determines whether a character is a control character
public static bool IsControl(int character)
Parameters
characterintThe character to check whether it's a control character
Returns
Remarks
WARNING: Regardless of the system locale, this will only treat ASCII values 0x00 through 0x1F, and 0x7F, as true.
IsControl(Rune)
Determines whether a character rune is a control character rune
public static bool IsControl(Rune rune)
Parameters
runeRuneThe character rune to check whether it's a control character rune
Returns
Remarks
WARNING: Regardless of the system locale, this will only treat ASCII values 0x00 through 0x1F, and 0x7F, as true.
IsDigit(int)
Determines whether a character is numerical (a number digit)
public static bool IsDigit(int character)
Parameters
characterintThe character to check whether it's numerical
Returns
Remarks
WARNING: Regardless of the system locale, this will only treat ASCII values 0x30 ('0') through 0x39 ('9') as true.
IsDigit(Rune)
Determines whether a character rune is numerical (a number digit)
public static bool IsDigit(Rune rune)
Parameters
runeRuneThe character rune to check whether it's numerical
Returns
Remarks
WARNING: Regardless of the system locale, this will only treat ASCII values 0x30 ('0') through 0x39 ('9') as true.
IsGraphic(int)
Determines whether a character is any "printable" character except for a space character
public static bool IsGraphic(int character)
Parameters
characterintThe character to check whether it's "printable" except for space
Returns
- bool
true, if thecharacteris a "printable" character except for a space character; otherwise,false
Remarks
Be advised that "printable" has a definition that goes back to text terminals from the dawn of computing, making this a sort of special case function that is not suitable for Unicode (or most any) text management.
WARNING: Regardless of the system locale, this will only treat ASCII values 0x21 ('!') through 0x7E ('~') as true.
IsGraphic(Rune)
Determines whether a character rune is any "printable" character rune except for a space character
public static bool IsGraphic(Rune rune)
Parameters
runeRuneThe character rune to check whether it's "printable" except for space
Returns
- bool
true, if theruneis a "printable" character rune except for a space character; otherwise,false
Remarks
Be advised that "printable" has a definition that goes back to text terminals from the dawn of computing, making this a sort of special case function that is not suitable for Unicode (or most any) text management.
WARNING: Regardless of the system locale, this will only treat ASCII values 0x21 ('!') through 0x7E ('~') as true.
IsHexDigit(int)
Determines whether a character is numerical for a hexadecimal number (a hexadecimal number digit)
public static bool IsHexDigit(int character)
Parameters
characterintThe character to check whether it's numerical for a hexadecimal number
Returns
Remarks
WARNING: Regardless of the system locale, this will only treat ASCII values for English 0x30 ('0') through 0x39 ('9'), 0x41 ('A') through 0x46 ('F'), and 0x61 ('a') through 0x66 ('f') as true.
IsHexDigit(Rune)
Determines whether a character rune is numerical for a hexadecimal number (a hexadecimal number digit)
public static bool IsHexDigit(Rune rune)
Parameters
runeRuneThe character rune to check whether it's numerical for a hexadecimal number
Returns
Remarks
WARNING: Regardless of the system locale, this will only treat ASCII values for English 0x30 ('0') through 0x39 ('9'), 0x41 ('A') through 0x46 ('F'), and 0x61 ('a') through 0x66 ('f') as true.
IsLower(int)
Determines whether a character is lower case
public static bool IsLower(int character)
Parameters
characterintThe character to check whether it's lower case
Returns
Remarks
WARNING: Regardless of the system locale, this will only treat ASCII values for English 0x61 ('a') through 0x7A ('z') as true.
IsLower(Rune)
Determines whether a character rune is lower case
public static bool IsLower(Rune rune)
Parameters
runeRuneThe character rune to check whether it's lower case
Returns
Remarks
WARNING: Regardless of the system locale, this will only treat ASCII values for English 0x61 ('a') through 0x7A ('z') as true.
IsPrintable(int)
Determines whether a character is "printable"
public static bool IsPrintable(int character)
Parameters
characterintThe character to check whether it's "printable"
Returns
Remarks
Be advised that "printable" has a definition that goes back to text terminals from the dawn of computing, making this a sort of special case function that is not suitable for Unicode (or most any) text management.
WARNING: Regardless of the system locale, this will only treat ASCII values 0x20 (' ') through 0x7E ('~') as true.
IsPrintable(Rune)
Determines whether a character rune is "printable"
public static bool IsPrintable(Rune rune)
Parameters
runeRuneThe character rune to check whether it's "printable"
Returns
Remarks
Be advised that "printable" has a definition that goes back to text terminals from the dawn of computing, making this a sort of special case function that is not suitable for Unicode (or most any) text management.
WARNING: Regardless of the system locale, this will only treat ASCII values 0x20 (' ') through 0x7E ('~') as true.
IsPunctuation(int)
Determines whether a character is a punctuation mark
public static bool IsPunctuation(int character)
Parameters
characterintThe character to check whether it's a punctuation mark
Returns
Remarks
WARNING: Regardless of the system locale, this is equivalent to IsGraphic(int) && !IsAlphaNumeric(int).
IsPunctuation(Rune)
Determines whether a character rune is a punctuation mark
public static bool IsPunctuation(Rune rune)
Parameters
runeRuneThe character rune to check whether it's a punctuation mark
Returns
Remarks
WARNING: Regardless of the system locale, this is equivalent to IsGraphic(Rune) && !IsAlphaNumeric(Rune).
IsSpace(int)
Determines whether a character is a whitespace
public static bool IsSpace(int character)
Parameters
characterintThe character to check whether it's a whitespace
Returns
Remarks
WARNING: Regardless of the system locale, this will only treat the following ASCII values as true:
0x09('\t')0x0A('\n')0x0B('\v')0x0C('\f')0x0D('\r')0x20(' ')
IsSpace(Rune)
Determines whether a character rune is a whitespace
public static bool IsSpace(Rune rune)
Parameters
runeRuneThe character rune to check whether it's a whitespace
Returns
Remarks
WARNING: Regardless of the system locale, this will only treat the following ASCII values as true:
0x09('\t')0x0A('\n')0x0B('\v')0x0C('\f')0x0D('\r')0x20(' ')
IsUpper(int)
Determines whether a character is upper case
public static bool IsUpper(int character)
Parameters
characterintThe character to check whether it's upper case
Returns
Remarks
WARNING: Regardless of the system locale, this will only treat ASCII values for English 0x41 ('A') through 0x5A ('Z') as true.
IsUpper(Rune)
Determines whether a character rune is upper case
public static bool IsUpper(Rune rune)
Parameters
runeRuneThe character rune to check whether it's upper case
Returns
Remarks
WARNING: Regardless of the system locale, this will only treat ASCII values for English 0x41 ('A') through 0x5A ('Z') as true.
ToLower(int)
Converts a character to lower case
public static int ToLower(int character)
Parameters
characterintThe character to covert to lower case
Returns
- int
The lower case version of the given
character, if it's convertable and not already lower case; otherwise, just the givencharacter
Remarks
WARNING: Regardless of the system locale, this will only convert ASCII values 0x41 ('A') through 0x5A ('Z') to lower case.
If the given character cannot be converted, or it is already lower case, this method just returns the given character.
ToLower(Rune)
Converts a character rune to lower case
public static Rune ToLower(Rune rune)
Parameters
runeRuneThe character rune to covert to lower case
Returns
- Rune
The lower case version of the given
rune, if it's convertable and not already lower case; otherwise, just the givenrune
Remarks
WARNING: Regardless of the system locale, this will only convert ASCII values 0x41 ('A') through 0x5A ('Z') to lower case.
If the given character rune cannot be converted, or it is already lower case, this method just returns the given character rune.
ToUpper(int)
Converts a character to upper case
public static int ToUpper(int character)
Parameters
characterintThe character to covert to upper case
Returns
- int
The upper case version of the given
character, if it's convertable and not already upper case; otherwise, just the givencharacter
Remarks
WARNING: Regardless of the system locale, this will only convert ASCII values 0x61 ('a') through 0x7A ('z') to upper case.
If the given character cannot be converted, or it is already upper case, this method just returns the given character.
ToUpper(Rune)
Converts a character rune to upper case
public static Rune ToUpper(Rune rune)
Parameters
runeRuneThe character rune to covert to upper case
Returns
- Rune
The upper case version of the given
rune, if it's convertable and not already upper case; otherwise, just the givenrune
Remarks
WARNING: Regardless of the system locale, this will only convert ASCII values 0x61 ('a') through 0x7A ('z') to upper case.
If the given character rune cannot be converted, or it is already upper case, this method just returns the given character rune.