Rune Struct

Definition

Represents a Unicode scalar value ([ U+0000..U+D7FF ], inclusive; or [ U+E000..U+10FFFF ], inclusive).

public readonly struct Rune : IComparable, IComparable<System.Text.Rune>, IEquatable<System.Text.Rune>
public readonly struct Rune : IComparable, IComparable<System.Text.Rune>, IEquatable<System.Text.Rune>, ISpanFormattable
public readonly struct Rune : IComparable, IComparable<System.Text.Rune>, IEquatable<System.Text.Rune>, ISpanFormattable, IUtf8SpanFormattable
public readonly struct Rune : IComparable<System.Text.Rune>, IEquatable<System.Text.Rune>
Inheritance
Implements

Remarks

For more information about this API, see Supplemental API remarks for Rune.

Constructors

Rune(Char, Char)

Creates a Rune from the provided UTF-16 surrogate pair.

Rune(Char)

Creates a Rune from the provided UTF-16 code unit.

Rune(Int32)

Creates a Rune from the specified 32-bit integer that represents a Unicode scalar value.

Rune(UInt32)

Creates a Rune from the specified 32-bit unsigned integer that represents a Unicode scalar value.

Properties

IsAscii

Gets a value that indicates whether the scalar value associated with this Rune is within the ASCII encoding range.

IsBmp

Gets a value that indicates whether the scalar value associated with this Rune is within the BMP encoding range.

Plane

Gets the Unicode plane (0 to 16, inclusive) that contains this scalar.

ReplacementChar

Gets a Rune instance that represents the Unicode replacement character U+FFFD.

Utf16SequenceLength

Gets the length in code units (Char) of the UTF-16 sequence required to represent this scalar value.

Utf8SequenceLength

Gets the length in code units of the UTF-8 sequence required to represent this scalar value.

Value

Gets the Unicode scalar value as an integer.

Methods

CompareTo(Rune)

Compares the current instance to the specified Rune instance.

DecodeFromUtf16(ReadOnlySpan<Char>, Rune, Int32)

Decodes the Rune at the beginning of the provided UTF-16 source buffer.

DecodeFromUtf8(ReadOnlySpan<Byte>, Rune, Int32)

Decodes the Rune at the beginning of the provided UTF-8 source buffer.

DecodeLastFromUtf16(ReadOnlySpan<Char>, Rune, Int32)

Decodes the Rune at the end of the provided UTF-16 source buffer.

DecodeLastFromUtf8(ReadOnlySpan<Byte>, Rune, Int32)

Decodes the Rune at the end of the provided UTF-8 source buffer.

EncodeToUtf16(Span<Char>)

Encodes this Rune to a UTF-16 destination buffer.

EncodeToUtf8(Span<Byte>)

Encodes this Rune to a UTF-8 destination buffer.

Equals(Object)

Returns a value that indicates whether the current instance and a specified object are equal.

Equals(Rune)

Returns a value that indicates whether the current instance and a specified rune are equal.

GetHashCode()

Returns the hash code for this instance.

GetNumericValue(Rune)

Gets the numeric value associated with the specified rune.

GetRuneAt(String, Int32)

Gets the Rune that begins at a specified position in a string.

GetUnicodeCategory(Rune)

Gets the Unicode category associated with the specified rune.

IsControl(Rune)

Returns a value that indicates whether the specified rune is categorized as a control character.

IsDigit(Rune)

Returns a value that indicates whether the specified rune is categorized as a decimal digit.

IsLetter(Rune)

Returns a value that indicates whether the specified rune is categorized as a letter.

IsLetterOrDigit(Rune)

Returns a value that indicates whether the specified rune is categorized as a letter or a decimal digit.

IsLower(Rune)

Returns a value that indicates whether the specified rune is categorized as a lowercase letter.

IsNumber(Rune)

Returns a value that indicates whether the specified rune is categorized as a number.

IsPunctuation(Rune)

Returns a value that indicates whether the specified rune is categorized as a punctuation mark.

IsSeparator(Rune)

Returns a value that indicates whether the specified rune is categorized as a separator character.

IsSymbol(Rune)

Returns a value that indicates whether the specified rune is categorized as a symbol character.

IsUpper(Rune)

Returns a value that indicates whether the specified rune is categorized as an uppercase letter.

IsValid(Int32)

Returns a value that indicates whether a 32-bit signed integer represents a valid Unicode scalar value; that is, it is in the range [ U+0000..U+D7FF ], inclusive; or [ U+E000..U+10FFFF ], inclusive.

IsValid(UInt32)

Returns a value that indicates whether a 32-bit unsigned integer represents a valid Unicode scalar value; that is, it is in the range [ U+0000..U+D7FF ], inclusive, or [ U+E000..U+10FFFF ], inclusive.

IsWhiteSpace(Rune)

Returns a value that indicates whether the specified rune is categorized as a white space character.

ToLower(Rune, CultureInfo)

Returns a copy of the specified Rune converted to lowercase, using the casing rules of the specified culture.

ToLowerInvariant(Rune)

Returns a copy of the specified Rune converted to lowercase using the casing rules of the invariant culture.

ToString()

Returns the string representation of this Rune instance.

ToUpper(Rune, CultureInfo)

Returns a copy of the specified Rune converted to uppercase, using the casing rules of the specified culture.

ToUpperInvariant(Rune)

Returns a copy of the specified Rune converted to uppercase using the casing rules of the invariant culture.

TryCreate(Char, Char, Rune)

Attempts to create a Rune from the specified UTF-16 surrogate pair and returns a value that indicates whether the operation was successful.

TryCreate(Char, Rune)

Attempts to create a Rune from a specified character and returns a value that indicates whether the operation succeeded.

TryCreate(Int32, Rune)

Attempts to create a Rune from a specified signed integer that represents a Unicode scalar value.

TryCreate(UInt32, Rune)

Attempts to create a Rune from the specified 32-bit unsigned integer that represents a Unicode scalar value.

TryEncodeToUtf16(Span<Char>, Int32)

Encodes this Rune to a UTF-16 encoded destination buffer.

TryEncodeToUtf8(Span<Byte>, Int32)

Encodes this Rune to a UTF-8 encoded destination buffer.

TryGetRuneAt(String, Int32, Rune)

Attempts to get the Rune that begins at a specified position in a string, and return a value that indicates whether the operation succeeded.

Operators

Equality(Rune, Rune)

Returns a value that indicates whether two Rune instances are equal.

Explicit(Char to Rune)

Defines an explicit conversion of a 16-bit Unicode character to a Rune.

Explicit(Int32 to Rune)

Defines an explicit conversion of a 32-bit signed integer to a Rune.

Explicit(UInt32 to Rune)

Defines an explicit conversion of a 32-bit unsigned integer to a Rune.

GreaterThan(Rune, Rune)

Returns a value indicating whether a specified Rune is greater than another specified Rune.

GreaterThanOrEqual(Rune, Rune)

Returns a value indicating whether a specified Rune is greater than or equal to another specified Rune.

Inequality(Rune, Rune)

Returns a value that indicates whether two Rune instances have different values.

LessThan(Rune, Rune)

Returns a value indicating whether a specified Rune is less than another specified Rune.

LessThanOrEqual(Rune, Rune)

Returns a value indicating whether a specified Rune is less than or equal to another specified Rune.

Explicit Interface Implementations

IComparable.CompareTo(Object)

Compares the current instance to the specified object.

IFormattable.ToString(String, IFormatProvider)

Formats the value of the current instance using the specified format.

ISpanFormattable.TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider)

Tries to format the value of the current instance into the provided span of characters.

IUtf8SpanFormattable.TryFormat(Span<Byte>, Int32, ReadOnlySpan<Char>, IFormatProvider)

Tries to format the value of the current instance as UTF-8 into the provided span of bytes.

Applies to

Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9