Table of Contents

Class Character

Namespace
Sdl3Sharp.Utilities
Assembly
Sdl3Sharp.dll

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

character int

The character to check whether it's alphabetical

Returns

bool

true, if the character is an alphabetical character; otherwise, false

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

rune Rune

The character rune to check whether it's alphabetical

Returns

bool

true, if the rune is an alphabetical character rune; otherwise, false

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

character int

The character to check whether it's alphabetical or numerical

Returns

bool

true, if the character is an alphabetical or a numerical character; otherwise, false

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

rune Rune

The character rune to check whether it's alphabetical or numerical

Returns

bool

true, if the rune is an alphabetical or a numerical character rune; otherwise, false

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

character int

The character to check whether it's blank

Returns

bool

true, if the character is a blank character; otherwise, false

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

rune Rune

The character rune to check whether it's blank

Returns

bool

true, if the rune is a blank character rune; otherwise, false

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

character int

The character to check whether it's a control character

Returns

bool

true, if the character is a control character; otherwise, false

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

rune Rune

The character rune to check whether it's a control character rune

Returns

bool

true, if the rune is a control character rune; otherwise, false

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

character int

The character to check whether it's numerical

Returns

bool

true, if the character is a numerical character; otherwise, false

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

rune Rune

The character rune to check whether it's numerical

Returns

bool

true, if the rune is a numerical character rune; otherwise, false

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

character int

The character to check whether it's "printable" except for space

Returns

bool

true, if the character is 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

rune Rune

The character rune to check whether it's "printable" except for space

Returns

bool

true, if the rune is 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

character int

The character to check whether it's numerical for a hexadecimal number

Returns

bool

true, if the character is a numerical character for a hexadecimal number; otherwise, false

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

rune Rune

The character rune to check whether it's numerical for a hexadecimal number

Returns

bool

true, if the rune is a numerical character rune for a hexadecimal number; otherwise, false

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

character int

The character to check whether it's lower case

Returns

bool

true, if the character is a lower case character; otherwise, false

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

rune Rune

The character rune to check whether it's lower case

Returns

bool

true, if the rune is a lower case character rune; otherwise, false

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

character int

The character to check whether it's "printable"

Returns

bool

true, if the character is a "printable" 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 0x20 (' ') through 0x7E ('~') as true.

IsPrintable(Rune)

Determines whether a character rune is "printable"

public static bool IsPrintable(Rune rune)

Parameters

rune Rune

The character rune to check whether it's "printable"

Returns

bool

true, if the rune is a "printable" character rune; 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 0x20 (' ') through 0x7E ('~') as true.

IsPunctuation(int)

Determines whether a character is a punctuation mark

public static bool IsPunctuation(int character)

Parameters

character int

The character to check whether it's a punctuation mark

Returns

bool

true, if the character is a punctuation mark character; otherwise, false

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

rune Rune

The character rune to check whether it's a punctuation mark

Returns

bool

true, if the rune is a punctuation mark character rune; otherwise, false

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

character int

The character to check whether it's a whitespace

Returns

bool

true, if the character is a whitespace character; otherwise, false

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

rune Rune

The character rune to check whether it's a whitespace

Returns

bool

true, if the rune is a whitespace character rune; otherwise, false

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

character int

The character to check whether it's upper case

Returns

bool

true, if the character is a upper case character; otherwise, false

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

rune Rune

The character rune to check whether it's upper case

Returns

bool

true, if the rune is a upper case character rune; otherwise, false

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

character int

The 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 given character

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

rune Rune

The 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 given rune

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

character int

The 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 given character

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

rune Rune

The 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 given rune

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.