Class CharEx
Class containing some extension methods for System.Char.
Inheritance
Inherited Members
Namespace:Extend
Assembly:Extend.dll
Syntax
public static class CharEx
Methods
| Improve this Doc View SourceIsDigit(Char)
Indicates whether the specified Unicode character is categorized as a decimal digit.
Declaration
public static bool IsDigit(this char c)
Parameters
Type | Name | Description |
---|---|---|
System.Char | c | The Unicode character to evaluate. |
Returns
Type | Description |
---|---|
System.Boolean | True if the given char is a decimal digit, otherwise false. |
IsLetter(Char)
Indicates whether the specified Unicode character is categorized as a Unicode letter.
Declaration
public static bool IsLetter(this char c)
Parameters
Type | Name | Description |
---|---|---|
System.Char | c | The Unicode character to evaluate. |
Returns
Type | Description |
---|---|
System.Boolean | True if the given char is a letter, otherwise false. |
IsLetterOrDigit(Char)
Indicates whether the specified Unicode character is categorized as a letter or a decimal digit.
Declaration
public static bool IsLetterOrDigit(this char c)
Parameters
Type | Name | Description |
---|---|---|
System.Char | c | The Unicode character to evaluate. |
Returns
Type | Description |
---|---|
System.Boolean | True if the given char is a letter or a decimal digit, otherwise false. |
IsLower(Char)
Indicates whether the specified Unicode character is categorized as a lowercase letter.
Declaration
public static bool IsLower(this char c)
Parameters
Type | Name | Description |
---|---|---|
System.Char | c | The Unicode character to evaluate. |
Returns
Type | Description |
---|---|
System.Boolean | True if the given char is a lowercase letter, otherwise false. |
IsNumber(Char)
Indicates whether the specified Unicode character is categorized as a number.
Declaration
public static bool IsNumber(this char c)
Parameters
Type | Name | Description |
---|---|---|
System.Char | c | The Unicode character to evaluate. |
Returns
Type | Description |
---|---|
System.Boolean | True if the given char is a number, otherwise false. |
IsUpper(Char)
Indicates whether the specified Unicode character is categorized as an uppercase letter.
Declaration
public static bool IsUpper(this char c)
Parameters
Type | Name | Description |
---|---|---|
System.Char | c | The Unicode character to evaluate. |
Returns
Type | Description |
---|---|
System.Boolean | True if the given char is an uppercase letter, otherwise false. |
IsWhiteSpace(Char)
Indicates whether the specified Unicode character is categorized as white space.
Declaration
public static bool IsWhiteSpace(this char c)
Parameters
Type | Name | Description |
---|---|---|
System.Char | c | The Unicode character to evaluate. |
Returns
Type | Description |
---|---|
System.Boolean | True if the given char is a white space, otherwise false. |
Repeat(Char, Int32)
Repeats the given Char the specified number of times.
Declaration
public static string Repeat(this char c, int repeatCount)
Parameters
Type | Name | Description |
---|---|---|
System.Char | c | The Char to repeat. |
System.Int32 | repeatCount | Number of repeats. |
Returns
Type | Description |
---|---|
System.String | The repeated Char as String. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | repeatCount is less than zero. |
ToLower(Char)
Converts the value of a Unicode character to its lowercase equivalent.
Declaration
public static char ToLower(this char c)
Parameters
Type | Name | Description |
---|---|---|
System.Char | c | The Unicode character to convert. |
Returns
Type | Description |
---|---|
System.Char | The lowercase equivalent of c, 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.
Declaration
public static char ToUpper(this char c)
Parameters
Type | Name | Description |
---|---|---|
System.Char | c | The Unicode character to convert. |
Returns
Type | Description |
---|---|
System.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. |