Table of Contents

Class CharExtensions

Namespace
AngleSharp.Text
Assembly
AngleSharp.dll

Useful methods for chars.

public static class CharExtensions
Inheritance
CharExtensions
Inherited Members

Methods

FromHex(char)

Converts a given character from the hex representation (0-9A-Fa-f) to an integer.

public static int FromHex(this char c)

Parameters

c char

The character to convert.

Returns

int

The integer value or undefined behavior if invalid.

IsAlphanumericAscii(char)

Determines if the given character is a alphanumeric character (0-9a-zA-z) as specified here: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#alphanumeric-ascii-characters

public static bool IsAlphanumericAscii(this char c)

Parameters

c char

The character to examine.

Returns

bool

The result of the test.

IsCustomElementName(char)

Gets if the character is actually a character that can be used for building a custom element name. See https://html.spec.whatwg.org/#valid-custom-element-name

public static bool IsCustomElementName(this char c)

Parameters

c char

The character to examine.

Returns

bool

The result of the test.

IsDigit(char)

Determines if the given character is a digit (0-9) as specified here: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#ascii-digits

public static bool IsDigit(this char c)

Parameters

c char

The character to examine.

Returns

bool

The result of the test.

IsHex(char)

Determines if the given character is a hexadecimal (0-9a-fA-F) as specified here: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#ascii-hex-digits

public static bool IsHex(this char c)

Parameters

c char

The character to examine.

Returns

bool

The result of the test.

IsInRange(char, int, int)

Determines if the given character is in the given range.

public static bool IsInRange(this char c, int lower, int upper)

Parameters

c char

The character to examine.

lower int

The lower bound of the range.

upper int

The upper bound of the range.

Returns

bool

The result of the test.

IsInvalid(int)

Determines if the given character is invalid, i.e. zero, above the max. codepoint or in an invalid range.

public static bool IsInvalid(this int c)

Parameters

c int

The character to examine.

Returns

bool

The result of the test.

IsLetter(char)

Gets if the character is actually a (A-Z,a-z) letter.

public static bool IsLetter(this char c)

Parameters

c char

The character to examine.

Returns

bool

The result of the test.

IsLineBreak(char)

Determines if the given character is a line break character as specified here: http://www.w3.org/TR/html401/struct/text.html#h-9.3.2

public static bool IsLineBreak(this char c)

Parameters

c char

The character to examine.

Returns

bool

The result of the test.

IsLowercaseAscii(char)

Determines if the given character is a lowercase character (a-z) as specified here: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#lowercase-ascii-letters

public static bool IsLowercaseAscii(this char c)

Parameters

c char

The character to examine.

Returns

bool

The result of the test.

IsName(char)

Gets if the character is actually a name character.

public static bool IsName(this char c)

Parameters

c char

The character to examine.

Returns

bool

The result of the test.

IsNameStart(char)

Determines if the given character is a valid character for starting an identifier.

public static bool IsNameStart(this char c)

Parameters

c char

The character to examine.

Returns

bool

The result of the test.

IsNonAscii(char)

Gets if the character is actually a non-ascii character.

public static bool IsNonAscii(this char c)

Parameters

c char

The character to examine.

Returns

bool

The result of the test.

IsNonPrintable(char)

Gets if the character is actually a non-printable (special) character.

public static bool IsNonPrintable(this char c)

Parameters

c char

The character to examine.

Returns

bool

The result of the test.

IsNormalPathCharacter(char)

Determines if the given character is allowed as-it-is in paths.

public static bool IsNormalPathCharacter(this char c)

Parameters

c char

The character to examine.

Returns

bool

The result of the test.

IsNormalQueryCharacter(char)

Determines if the given character is allowed as-it-is in queries.

public static bool IsNormalQueryCharacter(this char c)

Parameters

c char

The character to examine.

Returns

bool

The result of the test.

IsSpaceCharacter(char)

Determines if the given character is a space character as specified here: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#space-character

public static bool IsSpaceCharacter(this char c)

Parameters

c char

The character to examine.

Returns

bool

The result of the test.

IsUppercaseAscii(char)

Determines if the given character is a uppercase character (A-Z) as specified here: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#uppercase-ascii-letters

public static bool IsUppercaseAscii(this char c)

Parameters

c char

The character to examine.

Returns

bool

The result of the test.

IsUrlCodePoint(char)

Determines if the given character is a valid url code point as specified here: http://url.spec.whatwg.org/#url-code-points

public static bool IsUrlCodePoint(this char c)

Parameters

c char

The character to examine.

Returns

bool

The result of the test.

IsWhiteSpaceCharacter(char)

Determines if the given character is a white-space character as specified here: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#white_space

public static bool IsWhiteSpaceCharacter(this char c)

Parameters

c char

The character to examine.

Returns

bool

The result of the test.

ToHex(byte)

Transforms the given number to a hexadecimal string.

public static string ToHex(this byte num)

Parameters

num byte

The number (0-255).

Returns

string

A 2 digit upper case hexadecimal string.

ToHex(char)

Transforms the given character to a hexadecimal string.

public static string ToHex(this char character)

Parameters

character char

The single character.

Returns

string

A minimal digit lower case hexadecimal string.