CharHelper Class

Helper class for handling characters.

public static class CharHelper

Methods

NameDescription
AddTab(int)Adds tab.
CheckOpenCloseDelimiter(char, char, bool, bool, bool)Performs the check open close delimiter operation.
CheckOpenCloseDelimiter(Rune, Rune, bool, bool, bool)Performs the check open close delimiter operation.
CheckUnicodeCategory(char, bool, bool)Checks the Unicode category of the given character and determines whether it is a whitespace or punctuation character.
CheckUnicodeCategory(Rune, bool, bool)Check if a character is a Unicode whitespace or punctuation character.
EscapeInsecure(char)Performs the escape insecure operation.
IsAcrossTab(int)Determines whether across tab.
IsAlpha(char)Determines whether alpha.
IsAlphaNumeric(char)Determines whether alpha numeric.
IsAlphaUpper(char)Determines whether alpha upper.
IsAsciiPunctuation(char)Determines whether ascii punctuation.
IsControl(char)Determines whether control.
IsDigit(char)Determines whether digit.
IsEmailUsernameSpecialChar(char)Determines whether email username special char.
IsEscapableSymbol(char)Determines whether escapable symbol.
IsHighSurrogate(char)Determines whether high surrogate.
IsLeftToRight(int)Determines whether left to right.
IsLowSurrogate(char)Determines whether low surrogate.
IsNewLineOrLineFeed(char)Determines whether new line or line feed.
IsRightToLeft(int)Determines whether right to left.
IsRomanLetterLowerPartial(char)Determines whether roman letter lower partial.
IsRomanLetterPartial(char)Determines whether roman letter partial.
IsRomanLetterUpperPartial(char)Determines whether roman letter upper partial.
IsSpace(char)Returns true if the character is a space (U+0020).
IsSpaceOrTab(char)Returns true if the character is a space (U+0020) or tab (U+0009).
IsTab(char)Returns true if the character is a tab (U+0009).
IsWhiteSpaceOrZero(char)Determines whether white space or zero.
IsWhitespace(char)true if the character is a Unicode whitespace character.
IsWhitespace(Rune)true if the character is a Unicode whitespace character.
IsZero(char)Determines whether zero.
RomanToArabic(ReadOnlySpan<char>)Performs the roman to arabic operation.

AddTab(int)

CharHelper.cs

Adds tab.

public static int AddTab(int column)

Parameters

column int

Returns

int

CheckOpenCloseDelimiter overloads

CheckOpenCloseDelimiter(char, char, bool, bool, bool)

CharHelper.cs

Performs the check open close delimiter operation.

public static void CheckOpenCloseDelimiter(char pc, char c, bool enableWithinWord, out bool canOpen, out bool canClose)
Parameters
pc char
c char
enableWithinWord bool
canOpen bool
canClose bool

CheckOpenCloseDelimiter(Rune, Rune, bool, bool, bool)

CharHelper.cs

Performs the check open close delimiter operation.

public static void CheckOpenCloseDelimiter(Rune pc, Rune c, bool enableWithinWord, out bool canOpen, out bool canClose)
Parameters
pc Rune
c Rune
enableWithinWord bool
canOpen bool
canClose bool

CheckUnicodeCategory overloads

CheckUnicodeCategory(char, bool, bool)

CharHelper.cs

Checks the Unicode category of the given character and determines whether it is a whitespace or punctuation character.

public static void CheckUnicodeCategory(this char c, out bool space, out bool punctuation)
Parameters
c char
The character to check.
space bool
Output parameter indicating whether the character is a whitespace character.
punctuation bool
Output parameter indicating whether the character is a punctuation character.

CheckUnicodeCategory(Rune, bool, bool)

CharHelper.cs

Check if a character is a Unicode whitespace or punctuation character.

public static void CheckUnicodeCategory(this Rune r, out bool space, out bool punctuation)
Parameters
r Rune
The character to evaluate. A supplementary character is also accepted.
space bool
true if the character is an Unicode whitespace character
punctuation bool
true if the character is a Unicode punctuation character

EscapeInsecure(char)

CharHelper.cs

Performs the escape insecure operation.

public static char EscapeInsecure(this char c)

Parameters

c char

Returns

char

IsAcrossTab(int)

CharHelper.cs

Determines whether across tab.

public static bool IsAcrossTab(int column)

Parameters

column int

Returns

bool

IsAlpha(char)

CharHelper.cs

Determines whether alpha.

public static bool IsAlpha(this char c)

Parameters

c char

Returns

bool

IsAlphaNumeric(char)

CharHelper.cs

Determines whether alpha numeric.

public static bool IsAlphaNumeric(this char c)

Parameters

c char

Returns

bool

IsAlphaUpper(char)

CharHelper.cs

Determines whether alpha upper.

public static bool IsAlphaUpper(this char c)

Parameters

c char

Returns

bool

IsAsciiPunctuation(char)

CharHelper.cs

Determines whether ascii punctuation.

public static bool IsAsciiPunctuation(this char c)

Parameters

c char

Returns

bool

IsControl(char)

CharHelper.cs

Determines whether control.

public static bool IsControl(this char c)

Parameters

c char

Returns

bool

IsDigit(char)

CharHelper.cs

Determines whether digit.

public static bool IsDigit(this char c)

Parameters

c char

Returns

bool

IsEmailUsernameSpecialChar(char)

CharHelper.cs

Determines whether email username special char.

public static bool IsEmailUsernameSpecialChar(char c)

Parameters

c char

Returns

bool

IsEscapableSymbol(char)

CharHelper.cs

Determines whether escapable symbol.

public static bool IsEscapableSymbol(this char c)

Parameters

c char

Returns

bool

IsHighSurrogate(char)

CharHelper.cs

Determines whether high surrogate.

public static bool IsHighSurrogate(char c)

Parameters

c char

Returns

bool

IsLeftToRight(int)

CharHelper.cs

Determines whether left to right.

public static bool IsLeftToRight(int c)

Parameters

c int

Returns

bool

IsLowSurrogate(char)

CharHelper.cs

Determines whether low surrogate.

public static bool IsLowSurrogate(char c)

Parameters

c char

Returns

bool

IsNewLineOrLineFeed(char)

CharHelper.cs

Determines whether new line or line feed.

public static bool IsNewLineOrLineFeed(this char c)

Parameters

c char

Returns

bool

IsRightToLeft(int)

CharHelper.cs

Determines whether right to left.

public static bool IsRightToLeft(int c)

Parameters

c int

Returns

bool

IsRomanLetterLowerPartial(char)

CharHelper.cs

Determines whether roman letter lower partial.

public static bool IsRomanLetterLowerPartial(char c)

Parameters

c char

Returns

bool

IsRomanLetterPartial(char)

CharHelper.cs

Determines whether roman letter partial.

public static bool IsRomanLetterPartial(char c)

Parameters

c char

Returns

bool

IsRomanLetterUpperPartial(char)

CharHelper.cs

Determines whether roman letter upper partial.

public static bool IsRomanLetterUpperPartial(char c)

Parameters

c char

Returns

bool

IsSpace(char)

CharHelper.cs

Returns true if the character is a space (U+0020).

public static bool IsSpace(this char c)

Parameters

c char
The character to evaluate

Returns

bool true if the character is a space

IsSpaceOrTab(char)

CharHelper.cs

Returns true if the character is a space (U+0020) or tab (U+0009).

public static bool IsSpaceOrTab(this char c)

Parameters

c char
The character to evaluate.

Returns

bool true if the character is a space or tab

IsTab(char)

CharHelper.cs

Returns true if the character is a tab (U+0009).

public static bool IsTab(this char c)

Parameters

c char
The character to evaluate

Returns

bool true if the character is a tab

IsWhiteSpaceOrZero(char)

CharHelper.cs

Determines whether white space or zero.

public static bool IsWhiteSpaceOrZero(this char c)

Parameters

c char

Returns

bool

IsWhitespace overloads

IsWhitespace(char)

CharHelper.cs

true if the character is a Unicode whitespace character.

public static bool IsWhitespace(this char c)
Parameters
c char
The character to evaluate.
Returns

bool true if the character is a Unicode whitespace character

IsWhitespace(Rune)

CharHelper.cs

true if the character is a Unicode whitespace character.

public static bool IsWhitespace(this Rune r)
Parameters
r Rune
The character to evaluate. A supplementary character is also accepted.
Returns

bool true if the character is a Unicode whitespace character

IsZero(char)

CharHelper.cs

Determines whether zero.

public static bool IsZero(this char c)

Parameters

c char

Returns

bool

RomanToArabic(ReadOnlySpan<char>)

CharHelper.cs

Performs the roman to arabic operation.

public static int RomanToArabic(ReadOnlySpan<char> text)

Parameters

text ReadOnlySpan<char>

Returns

int

Constants

NameDescription
ReplacementCharRepresents the replacement char.
ReplacementCharStringRepresents the replacement char string.
TabSizeRepresents the tab size.

ReplacementChar

Represents the replacement char.

public const char ReplacementChar = '�'

ReplacementCharString

Represents the replacement char string.

public const string ReplacementCharString = "�"

TabSize

Represents the tab size.

public const int TabSize = 4