Table of Contents

Class CharHelper

Namespace
SunamoChar
Assembly
SunamoChar.dll

Helper class for character operations including Unicode character detection and string manipulation

public class CharHelper
Inheritance
CharHelper
Inherited Members
Extension Methods

Methods

CharWhichIsNotContained(Type, string)

Finds a character constant from type that is not contained in text.

public static string? CharWhichIsNotContained(Type typeAllChars, string text)

Parameters

typeAllChars Type

The type containing character constants to search.

text string

The text to check for character containment.

Returns

string

The first character constant not found in the text, or null if all are contained.

IsGeneric(char)

Checks if a character is a generic character.

public static bool IsGeneric(char character)

Parameters

character char

The character to check.

Returns

bool

True if the character is a generic character, false otherwise.

IsSpecial(char)

Checks if a character is a special character.

public static bool IsSpecial(char character)

Parameters

character char

The character to check.

Returns

bool

True if the character is a special character, false otherwise.

IsSpecialChar(int, ref string, ref char, bool)

Returns whether the character is whitespace or punctuation.

public static bool IsSpecialChar(int index, ref string text, ref char character, bool isImmediatelyRemoving = false)

Parameters

index int

Index of the character to check in the text.

text string

The text containing the character.

character char

Output parameter for the character at the specified index.

isImmediatelyRemoving bool

Whether to immediately remove the character from text if it is special.

Returns

bool

True if the character at the specified index is a special character, false otherwise.

IsUnicodeChar(UnicodeChars, char)

Checks if a character matches the specified Unicode character type

public static bool IsUnicodeChar(UnicodeChars unicodeCharType, char character)

Parameters

unicodeCharType UnicodeChars

The Unicode character type to check against.

character char

The character to check.

Returns

bool

True if the character matches the specified type, false otherwise.

IsUnicodeChar(char)

Determines the Unicode character type of a character.

public static UnicodeChars IsUnicodeChar(char character)

Parameters

character char

The character to classify.

Returns

UnicodeChars

The Unicode character type category of the specified character.

OnlyAccepted(string, List<Func<char, bool>>, bool)

Returns only characters that match any of the predicates.

public static string OnlyAccepted(string text, List<Func<char, bool>> predicates, bool isNegating = false)

Parameters

text string

The text to filter.

predicates List<Func<char, bool>>

List of functions to test each character.

isNegating bool

Whether to negate the predicate results.

Returns

string

String containing only the characters that match any of the predicates.

OnlyAccepted(string, Func<char, bool>, bool)

Returns only characters that match the predicate.

public static string OnlyAccepted(string text, Func<char, bool> predicate, bool isNegating = false)

Parameters

text string

The text to filter.

predicate Func<char, bool>

Function to test each character.

isNegating bool

Whether to negate the predicate result.

Returns

string

String containing only the characters that match the predicate.

OnlyDigits(string)

Returns only digit characters from text.

public static string OnlyDigits(string text)

Parameters

text string

The text to extract digits from.

Returns

string

String containing only the digit characters from the input text.

SplitSpecial(string, params char[])

Splits text by special delimiters, removing empty entries.

public static List<string> SplitSpecial(string text, params char[] delimiters)

Parameters

text string

The text to split.

delimiters char[]

Characters to use as delimiters.

Returns

List<string>

List of string parts after splitting.

SplitSpecialNone(string, params char[])

Splits text by special delimiters, keeping empty entries.

public static List<string> SplitSpecialNone(string text, params char[] delimiters)

Parameters

text string

The text to split.

delimiters char[]

Characters to use as delimiters.

Returns

List<string>

List of string parts after splitting, including empty entries.

TypesOfUnicodeChars(string)

Returns list of distinct Unicode character types found in text.

public static List<UnicodeChars> TypesOfUnicodeChars(string text)

Parameters

text string

The text to analyze for Unicode character types.

Returns

List<UnicodeChars>

List of distinct Unicode character type categories found in the text.