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
ccharThe Unicode character to convert.
Returns
- double
The numeric value of
cif 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
ccharThe 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
ccharThe 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
ccharThe 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
ccharThe character to check whether it is a valid Base 64 character.
Returns
IsControl(char)
Indicates whether the specified Unicode character is categorized as a control character.
[ExcludeFromCodeCoverage]
public static bool IsControl(this char c)
Parameters
ccharThe Unicode character to evaluate.
Returns
IsDigit(char)
Indicates whether the specified Unicode character is categorized as a decimal digit.
[ExcludeFromCodeCoverage]
public static bool IsDigit(this char c)
Parameters
ccharThe Unicode character to evaluate.
Returns
IsEnglishLetter(char)
Checks whether the character is a English letter character.
public static bool IsEnglishLetter(this char c)
Parameters
ccharThe character to check whether it is a English letter character.
Returns
IsEnglishLetterOrDigit(char)
Checks whether the character is a English letter or a digit character.
public static bool IsEnglishLetterOrDigit(this char c)
Parameters
ccharThe character to check whether it is a English letter or a digit character.
Returns
IsHighSurrogate(char)
Indicates whether the specified char object is a high surrogate.
[ExcludeFromCodeCoverage]
public static bool IsHighSurrogate(this char c)
Parameters
ccharThe Unicode character to evaluate.
Returns
- bool
true if the numeric value of the
cparameter 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
ccharThe Unicode character to evaluate.
Returns
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
ccharThe Unicode character to evaluate.
Returns
IsLowSurrogate(char)
Indicates whether the specified char object is a low surrogate.
[ExcludeFromCodeCoverage]
public static bool IsLowSurrogate(this char c)
Parameters
ccharThe character to evaluate.
Returns
- bool
true if the numeric value of the
cparameter 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
ccharThe Unicode character to evaluate.
Returns
IsLowerCaseEnglishLetter(char)
Checks whether the character is a lower case English letter.
public static bool IsLowerCaseEnglishLetter(this char c)
Parameters
ccharThe character to check whether it is a lower case English letter.
Returns
IsNumber(char)
Indicates whether the specified Unicode character is categorized as a number.
[ExcludeFromCodeCoverage]
public static bool IsNumber(this char c)
Parameters
ccharThe Unicode character to evaluate.
Returns
IsPunctuation(char)
Indicates whether the specified Unicode character is categorized as a punctuation mark.
[ExcludeFromCodeCoverage]
public static bool IsPunctuation(this char c)
Parameters
ccharThe Unicode character to evaluate.
Returns
IsSeparator(char)
Indicates whether the specified Unicode character is categorized as a separator character.
[ExcludeFromCodeCoverage]
public static bool IsSeparator(this char c)
Parameters
ccharThe Unicode character to evaluate.
Returns
IsSurrogate(char)
Indicates whether the specified character has a surrogate code unit.
[ExcludeFromCodeCoverage]
public static bool IsSurrogate(this char c)
Parameters
ccharThe Unicode character to evaluate.
Returns
IsSymbol(char)
Indicates whether the specified Unicode character is categorized as a symbol character.
[ExcludeFromCodeCoverage]
public static bool IsSymbol(this char c)
Parameters
ccharThe Unicode character to evaluate.
Returns
IsUpper(char)
Indicates whether the specified Unicode character is categorized as an uppercase letter.
[ExcludeFromCodeCoverage]
public static bool IsUpper(this char c)
Parameters
ccharThe Unicode character to evaluate.
Returns
IsUpperCaseEnglishLetter(char)
Checks whether the character is a upper case English letter.
public static bool IsUpperCaseEnglishLetter(this char c)
Parameters
ccharThe character to check whether it is a upper case English letter.
Returns
IsValidHexCharacter(char)
Determines whether the character is a valid hex character.
public static bool IsValidHexCharacter(this char c)
Parameters
ccharThe 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
ccharThe Unicode character to evaluate.
Returns
ToLower(char)
Converts the value of a Unicode character to its lowercase equivalent.
[ExcludeFromCodeCoverage]
public static char ToLower(this char c)
Parameters
ccharThe Unicode character to convert.
Returns
- char
The lowercase equivalent of
c, or the unchanged value ofc, ifcis 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
ccharThe Unicode character to convert.
cultureCultureInfoAn object that supplies culture-specific casing rules.
Returns
- char
The lowercase equivalent of
c, modified according toculture, or the unchanged value ofc, ifcis already lowercase or not alphabetic.
Exceptions
- ArgumentNullException
cultureis 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
ccharThe Unicode character to convert.
Returns
- char
The lowercase equivalent of the
cparameter, or the unchanged value ofc, ifcis 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
ccharThe Unicode character to convert.
Returns
- char
The uppercase equivalent of
c, or the unchanged value ofcifcis 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
ccharThe Unicode character to convert.
cultureCultureInfoAn object that supplies culture-specific casing rules.
Returns
- char
The uppercase equivalent of
c, modified according toculture, or the unchanged value ofcifcis already uppercase, has no uppercase equivalent, or is not alphabetic.
Exceptions
- ArgumentNullException
cultureis 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
ccharThe Unicode character to convert.
Returns
- char
The uppercase equivalent of the
cparameter, or the unchanged value ofc, ifcis already uppercase or not alphabetic.