UnicodeCharacterUtility Class

Provides utility methods to classify Unicode characters.

public static class UnicodeCharacterUtility

Methods

NameDescription
IsIdentifierPartCharacter(char)Checks whether a Unicode character can be a part of a C# or Visual Basic identifier.
IsIdentifierStartCharacter(char)Checks whether a Unicode character can be the first character of a C# or Visual Basic identifier.
IsValidIdentifier(ReadOnlySpan<char>)Checks whether a span of Unicode characters is a valid C# or Visual Basic identifier.
IsValidIdentifier(string?)Checks whether a Unicode string is a valid C# or Visual Basic identifier.

IsIdentifierPartCharacter(char)

Checks whether a Unicode character can be a part of a C# or Visual Basic identifier.

public static bool IsIdentifierPartCharacter(char ch)

Parameters

ch char
The character to check.

Returns

bool true if ch can be a part of an identifier; otherwise, false.

IsIdentifierStartCharacter(char)

Checks whether a Unicode character can be the first character of a C# or Visual Basic identifier.

public static bool IsIdentifierStartCharacter(char ch)

Parameters

ch char
The character to check.

Returns

bool true if ch can be the first character of an identifier; otherwise, false.

IsValidIdentifier overloads

IsValidIdentifier(ReadOnlySpan<char>)

Checks whether a span of Unicode characters is a valid C# or Visual Basic identifier.

public static bool IsValidIdentifier(ReadOnlySpan<char> name)
Parameters
name ReadOnlySpan<char>
The span to check.
Returns

bool true if name is a valid identifier; otherwise, false.

IsValidIdentifier(string?)

Checks whether a Unicode string is a valid C# or Visual Basic identifier.

public static bool IsValidIdentifier(string? name)
Parameters
name string?
The string to check.
Returns

bool true if name is a valid identifier; otherwise, false.