Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

struct System.​Text.​Rune

Assembly: System.Runtime

Implemented Interfaces

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

Properties

public bool
IsAscii
Gets a value that indicates whether the scalar value associated with this <see cref="T:System.Text.Rune" /> is within the ASCII encoding range.
public bool
IsBmp
Gets a value that indicates whether the scalar value associated with this <see cref="T:System.Text.Rune" /> is within the BMP encoding range.
public int
Plane
Gets the Unicode plane (0 to 16, inclusive) that contains this scalar.
public static Rune
ReplacementChar
Gets a <see cref="T:System.Text.Rune" /> instance that represents the Unicode replacement character U+FFFD.
public int
Utf16SequenceLength
Gets the length in code units ( <see cref="T:System.Char" /> ) of the UTF-16 sequence required to represent this scalar value.
public int
Utf8SequenceLength
Gets the length in code units of the UTF-8 sequence required to represent this scalar value.
public int
Value
Gets the Unicode scalar value as an integer.

Methods

public int
CompareTo​(Rune other)
Compares the current instance to the specified <see cref="T:System.Text.Rune" /> instance.
Returns A signed integer indicating the position of this instance in the sort order in relation to <paramref name="other" /> : <br /> - Less than zero: This instance precedes <paramref name="other" /> . <br /> - Zero: The instance has the same position in the sort order as <paramref name="other" /> . <br /> - Greater than zero: This instance follows <paramref name="other" /> .
other The instance to compare with the current instance.
DecodeFromUtf16​(ReadOnlySpan<​char> source, Rune& result, Int32& charsConsumed)
DecodeFromUtf8​(ReadOnlySpan<​byte> source, Rune& result, Int32& bytesConsumed)
DecodeLastFromUtf16​(ReadOnlySpan<​char> source, Rune& result, Int32& charsConsumed)
DecodeLastFromUtf8​(ReadOnlySpan<​byte> source, Rune& value, Int32& bytesConsumed)
public int
EncodeToUtf16​(Span<​char> destination)
Encodes this <see cref="T:System.Text.Rune" /> to a UTF-16 destination buffer.
Returns The number of <see cref="T:System.Char" /> values written to <paramref name="destination" /> .
destination The buffer to which to write this value as UTF-16.
public int
EncodeToUtf8​(Span<​byte> destination)
Encodes this <see cref="T:System.Text.Rune" /> to a UTF-8 destination buffer.
Returns The number of <see cref="T:System.Byte" /> values written to <paramref name="destination" /> .
destination The buffer to which to write this value as UTF-8.
public bool
Equals​(object obj)
Returns a value that indicates whether the current instance and a specified object are equal.
Returns <see langword="true" /> if <paramref name="obj" /> is of type <see cref="T:System.Text.Rune" /> and is equal to the current instance; otherwise, <see langword="false" /> .
obj The object to compare with the current instance.
public bool
Equals​(Rune other)
Returns a value that indicates whether the current instance and a specified rune are equal.
Returns <see langword="true" /> if the current instance and <paramref name="other" /> are equal; otherwise, <see langword="false" /> .
other The object to compare with the current instance.
public int
GetHashCode​()
Returns the hash code for this instance.
Returns The hash code for this instance.
public static double
GetNumericValue​(Rune value)
Gets the numeric value associated with the specified rune.
Returns The numeric value associated with <paramref name="value" /> , or -1 if <paramref name="value" /> doesn't represent a numeric character.
value The rune for which to get the numeric value.
public static Rune
GetRuneAt​(string input, int index)
Gets the <see cref="T:System.Text.Rune" /> that begins at a specified position in a string.
Returns The rune obtained from <paramref name="input" /> at the specified <paramref name="index" /> .
input The string from which to create the rune.
index The starting position in <paramref name="input" /> at which to create the rune.
GetUnicodeCategory​(Rune value)
Gets the Unicode category associated with the specified rune.
Returns The Unicode category associated with <paramref name="value" /> .
value The rune for which to get the Unicode category.
public static bool
IsControl​(Rune value)
Returns a value that indicates whether the specified rune is categorized as a control character.
Returns <see langword="true" /> if <paramref name="value" /> is a control character; otherwise, <see langword="false" /> .
value The rune to evaluate.
public static bool
IsDigit​(Rune value)
Returns a value that indicates whether the specified rune is categorized as a decimal digit.
Returns <see langword="true" /> if <paramref name="value" /> is a decimal digit; otherwise, <see langword="false" /> .
value The rune to evaluate.
public static bool
IsLetter​(Rune value)
Returns a value that indicates whether the specified rune is categorized as a letter.
Returns <see langword="true" /> if <paramref name="value" /> is a letter; otherwise, <see langword="false" /> .
value The rune to evaluate.
public static bool
IsLetterOrDigit​(Rune value)
Returns a value that indicates whether the specified rune is categorized as a letter or a decimal digit.
Returns <see langword="true" /> if <paramref name="value" /> is a letter or a decimal digit; otherwise, <see langword="false" /> .
value The rune to evaluate.
public static bool
IsLower​(Rune value)
Returns a value that indicates whether the specified rune is categorized as a lowercase letter.
Returns <see langword="true" /> if <paramref name="value" /> is a lowercase letter; otherwise, <see langword="false" /> .
value The rune to evaluate.
public static bool
IsNumber​(Rune value)
Returns a value that indicates whether the specified rune is categorized as a number.
Returns <see langword="true" /> if <paramref name="value" /> is a number; otherwise, <see langword="false" /> .
value The rune to evaluate.
public static bool
IsPunctuation​(Rune value)
Returns a value that indicates whether the specified rune is categorized as a punctuation mark.
Returns <see langword="true" /> if <paramref name="value" /> is a punctuation mark; otherwise, <see langword="false" /> .
value The rune to evaluate.
public static bool
IsSeparator​(Rune value)
Returns a value that indicates whether the specified rune is categorized as a separator character.
Returns <see langword="true" /> if <paramref name="value" /> is a separator character; otherwise, <see langword="false" /> .
value The rune to evaluate.
public static bool
IsSymbol​(Rune value)
Returns a value that indicates whether the specified rune is categorized as a symbol character.
Returns <see langword="true" /> if <paramref name="value" /> is a symbol character; otherwise, <see langword="false" /> .
value The rune to evaluate.
public static bool
IsUpper​(Rune value)
Returns a value that indicates whether the specified rune is categorized as an uppercase letter.
Returns <see langword="true" /> if <paramref name="value" /> is an uppercase letter; otherwise, <see langword="false" /> .
value The rune to evaluate.
public static bool
IsValid​(int value)
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.
Returns <see langword="true" /> if <paramref name="value" /> is a valid Unicode scalar value; otherwise, <see langword="false" /> .
value The Unicode scalar value.
public static bool
IsValid​(uint value)
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.
Returns <see langword="true" /> if <paramref name="value" /> is a valid Unicode scalar value; otherwise, <see langword="false" /> .
value The Unicode scalar value.
public static bool
IsWhiteSpace​(Rune value)
Returns a value that indicates whether the specified rune is categorized as a white space character.
Returns <see langword="true" /> if <paramref name="value" /> is a white space character; otherwise, <see langword="false" /> .
value The rune to evaluate.
public static Rune
ToLower​(Rune value, Globalization.​CultureInfo culture)
Returns a copy of the specified <see cref="T:System.Text.Rune" /> converted to lowercase, using the casing rules of the specified culture.
Returns The lowercase equivalent of <paramref name="value" /> .
value The 32-bit Unicode character to convert.
culture An object that supplies culture-specific casing rules.
public static Rune
ToLowerInvariant​(Rune value)
Returns a copy of the specified <see cref="T:System.Text.Rune" /> converted to lowercase using the casing rules of the invariant culture.
Returns The lowercase equivalent of <paramref name="value" /> .
value The 32-bit Unicode character to convert.
public string
ToString​()
Returns the string representation of this <see cref="T:System.Text.Rune" /> instance.
Returns The string representation of this rune.
public static Rune
ToUpper​(Rune value, Globalization.​CultureInfo culture)
Returns a copy of the specified <see cref="T:System.Text.Rune" /> converted to uppercase, using the casing rules of the specified culture.
Returns The uppercase equivalent of <paramref name="value" /> .
value The 32-bit Unicode character to convert.
culture An object that supplies culture-specific casing rules.
public static Rune
ToUpperInvariant​(Rune value)
Returns a copy of the specified <see cref="T:System.Text.Rune" /> converted to uppercase using the casing rules of the invariant culture.
Returns The uppercase equivalent of <paramref name="value" /> .
value The 32-bit Unicode character to convert.
public static bool
TryCreate​(char highSurrogate, char lowSurrogate, Rune& result)
public static bool
TryCreate​(char ch, Rune& result)
public static bool
TryCreate​(int value, Rune& result)
public static bool
TryCreate​(uint value, Rune& result)
public bool
TryEncodeToUtf16​(Span<​char> destination, Int32& charsWritten)
public bool
TryEncodeToUtf8​(Span<​byte> destination, Int32& bytesWritten)
public static bool
TryGetRuneAt​(string input, int index, Rune& value)
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public Type
GetType​()
Inherited from object
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .