Table of Contents

Class CharExtensions

Namespace
Garyon.Extensions
Assembly
Garyon.dll

Provides extensions for the char type.

public static class CharExtensions
Inheritance
CharExtensions
Inherited Members

Methods

GetNumericValue(char)

Converts the specified numeric Unicode character to a double-precision floating point number.

[ExcludeFromCodeCoverage]
public static double GetNumericValue(this char c)

Parameters

c char

The Unicode character to convert.

Returns

double

The numeric value of c if that character represents a number; otherwise, -1.0.

GetNumericValueInteger(char)

Gets the integer numeric value of the specified character.

public static int GetNumericValueInteger(this char c)

Parameters

c char

The character whose numeric value to get.

Returns

int

The integer numeric value that the character represents, otherwise -1.

GetNumericalValue(char)

Gets the numerical value of the decimal digit character.

public static int GetNumericalValue(this char c)

Parameters

c char

The decimal digit character.

Returns

int

The numerical value.

GetUnicodeCategory(char)

Categorizes a specified Unicode character into a group identified by one of the UnicodeCategory values.

[ExcludeFromCodeCoverage]
public static UnicodeCategory GetUnicodeCategory(this char c)

Parameters

c char

The Unicode character to categorize.

Returns

UnicodeCategory

A UnicodeCategory value that identifies the group that contains c.

IsBase64Character(char)

Checks whether the character is a valid Base 64 character.

public static bool IsBase64Character(this char c)

Parameters

c char

The character to check whether it is a valid Base 64 character.

Returns

bool

IsControl(char)

Indicates whether the specified Unicode character is categorized as a control character.

[ExcludeFromCodeCoverage]
public static bool IsControl(this char c)

Parameters

c char

The Unicode character to evaluate.

Returns

bool

true if c is a control character; otherwise, false.

IsDigit(char)

Indicates whether the specified Unicode character is categorized as a decimal digit.

[ExcludeFromCodeCoverage]
public static bool IsDigit(this char c)

Parameters

c char

The Unicode character to evaluate.

Returns

bool

true if c is a decimal digit; otherwise, false.

IsEnglishLetter(char)

Checks whether the character is a English letter character.

public static bool IsEnglishLetter(this char c)

Parameters

c char

The character to check whether it is a English letter character.

Returns

bool

IsEnglishLetterOrDigit(char)

Checks whether the character is a English letter or a digit character.

public static bool IsEnglishLetterOrDigit(this char c)

Parameters

c char

The character to check whether it is a English letter or a digit character.

Returns

bool

IsHighSurrogate(char)

Indicates whether the specified char object is a high surrogate.

[ExcludeFromCodeCoverage]
public static bool IsHighSurrogate(this char c)

Parameters

c char

The Unicode character to evaluate.

Returns

bool

true if the numeric value of the c parameter ranges from U+D800 through U+DBFF; otherwise, false.

IsLetter(char)

Indicates whether the specified Unicode character is categorized as a Unicode letter.

[ExcludeFromCodeCoverage]
public static bool IsLetter(this char c)

Parameters

c char

The Unicode character to evaluate.

Returns

bool

true if c is a letter; otherwise, false.

IsLetterOrDigit(char)

Indicates whether the specified Unicode character is categorized as a letter or a decimal digit.

[ExcludeFromCodeCoverage]
public static bool IsLetterOrDigit(this char c)

Parameters

c char

The Unicode character to evaluate.

Returns

bool

true if c is a letter or a decimal digit; otherwise, false.

IsLowSurrogate(char)

Indicates whether the specified char object is a low surrogate.

[ExcludeFromCodeCoverage]
public static bool IsLowSurrogate(this char c)

Parameters

c char

The character to evaluate.

Returns

bool

true if the numeric value of the c parameter ranges from U+DC00 through U+DFFF; otherwise, false.

IsLower(char)

Indicates whether the specified Unicode character is categorized as a lowercase letter.

[ExcludeFromCodeCoverage]
public static bool IsLower(this char c)

Parameters

c char

The Unicode character to evaluate.

Returns

bool

true if c is a lowercase letter; otherwise, false.

IsLowerCaseEnglishLetter(char)

Checks whether the character is a lower case English letter.

public static bool IsLowerCaseEnglishLetter(this char c)

Parameters

c char

The character to check whether it is a lower case English letter.

Returns

bool

IsNumber(char)

Indicates whether the specified Unicode character is categorized as a number.

[ExcludeFromCodeCoverage]
public static bool IsNumber(this char c)

Parameters

c char

The Unicode character to evaluate.

Returns

bool

true if c is a number; otherwise, false.

IsPunctuation(char)

Indicates whether the specified Unicode character is categorized as a punctuation mark.

[ExcludeFromCodeCoverage]
public static bool IsPunctuation(this char c)

Parameters

c char

The Unicode character to evaluate.

Returns

bool

true if c is a punctuation mark; otherwise, false.

IsSeparator(char)

Indicates whether the specified Unicode character is categorized as a separator character.

[ExcludeFromCodeCoverage]
public static bool IsSeparator(this char c)

Parameters

c char

The Unicode character to evaluate.

Returns

bool

true if c is a separator character; otherwise, false.

IsSurrogate(char)

Indicates whether the specified character has a surrogate code unit.

[ExcludeFromCodeCoverage]
public static bool IsSurrogate(this char c)

Parameters

c char

The Unicode character to evaluate.

Returns

bool

true if c is either a high surrogate or a low surrogate; otherwise, false.

IsSymbol(char)

Indicates whether the specified Unicode character is categorized as a symbol character.

[ExcludeFromCodeCoverage]
public static bool IsSymbol(this char c)

Parameters

c char

The Unicode character to evaluate.

Returns

bool

true if c is a symbol character; otherwise, false.

IsUpper(char)

Indicates whether the specified Unicode character is categorized as an uppercase letter.

[ExcludeFromCodeCoverage]
public static bool IsUpper(this char c)

Parameters

c char

The Unicode character to evaluate.

Returns

bool

true if c is an uppercase letter; otherwise, false.

IsUpperCaseEnglishLetter(char)

Checks whether the character is a upper case English letter.

public static bool IsUpperCaseEnglishLetter(this char c)

Parameters

c char

The character to check whether it is a upper case English letter.

Returns

bool

IsValidHexCharacter(char)

Determines whether the character is a valid hex character.

public static bool IsValidHexCharacter(this char c)

Parameters

c char

The character.

Returns

bool

true if the character is a valid hex character; equivalent to the regular expression [0-9a-fA-F], otherwise false.

IsWhiteSpace(char)

Indicates whether the specified Unicode character is categorized as white space.

[ExcludeFromCodeCoverage]
public static bool IsWhiteSpace(this char c)

Parameters

c char

The Unicode character to evaluate.

Returns

bool

true if c is white space; otherwise, false.

ToLower(char)

Converts the value of a Unicode character to its lowercase equivalent.

[ExcludeFromCodeCoverage]
public static char ToLower(this char c)

Parameters

c char

The Unicode character to convert.

Returns

char

The lowercase equivalent of c, or the unchanged value of c, if c is already lowercase or not alphabetic.

ToLower(char, CultureInfo)

Converts the value of a specified Unicode character to its lowercase equivalent using specified culture-specific formatting information.

[ExcludeFromCodeCoverage]
public static char ToLower(this char c, CultureInfo culture)

Parameters

c char

The Unicode character to convert.

culture CultureInfo

An object that supplies culture-specific casing rules.

Returns

char

The lowercase equivalent of c, modified according to culture, or the unchanged value of c, if c is already lowercase or not alphabetic.

Exceptions

ArgumentNullException

culture is null.

ToLowerInvariant(char)

Converts the value of a Unicode character to its lowercase equivalent using the casing rules of the invariant culture.

[ExcludeFromCodeCoverage]
public static char ToLowerInvariant(this char c)

Parameters

c char

The Unicode character to convert.

Returns

char

The lowercase equivalent of the c parameter, or the unchanged value of c, if c is already lowercase or not alphabetic.

ToUpper(char)

Converts the value of a Unicode character to its uppercase equivalent.

[ExcludeFromCodeCoverage]
public static char ToUpper(this char c)

Parameters

c char

The Unicode character to convert.

Returns

char

The uppercase equivalent of c, or the unchanged value of c if c is already uppercase, has no uppercase equivalent, or is not alphabetic.

ToUpper(char, CultureInfo)

Converts the value of a specified Unicode character to its uppercase equivalent using specified culture-specific formatting information.

[ExcludeFromCodeCoverage]
public static char ToUpper(this char c, CultureInfo culture)

Parameters

c char

The Unicode character to convert.

culture CultureInfo

An object that supplies culture-specific casing rules.

Returns

char

The uppercase equivalent of c, modified according to culture, or the unchanged value of c if c is already uppercase, has no uppercase equivalent, or is not alphabetic.

Exceptions

ArgumentNullException

culture is null.

ToUpperInvariant(char)

Converts the value of a Unicode character to its uppercase equivalent using the casing rules of the invariant culture.

[ExcludeFromCodeCoverage]
public static char ToUpperInvariant(this char c)

Parameters

c char

The Unicode character to convert.

Returns

char

The uppercase equivalent of the c parameter, or the unchanged value of c, if c is already uppercase or not alphabetic.