Rune Rune Rune Rune Struct

定义

表示 Unicode 标量值([ U+0000..U+D7FF ],含首尾值;或 [ U+E000..U+10FFFF ],含首尾值)。Represents a Unicode scalar value ([ U+0000..U+D7FF ], inclusive; or [ U+E000..U+10FFFF ], inclusive).

public value class Rune : IComparable<System::Text::Rune>, IEquatable<System::Text::Rune>
public struct Rune : IComparable<System.Text.Rune>, IEquatable<System.Text.Rune>
type Rune = struct
Public Structure Rune
Implements IComparable(Of Rune), IEquatable(Of Rune)
继承
实现

注解

此类型的构造函数和转换运算符将验证输入, 因此使用者可以调用 api, 假定基础Rune实例的格式正确。This type's constructors and conversion operators validate the input, so consumers can call the APIs assuming that the underlying Rune instance is well-formed.

构造函数

Rune(Char) Rune(Char) Rune(Char) Rune(Char)

从提供的 UTF-16 代码单元中创建 RuneCreates a Rune from the provided UTF-16 code unit.

Rune(Int32) Rune(Int32) Rune(Int32) Rune(Int32)

从表示 Unicode 标量值的指定 32 位整数中创建 RuneCreates a Rune from the specified 32-bit integer that represents a Unicode scalar value.

Rune(UInt32) Rune(UInt32) Rune(UInt32) Rune(UInt32)

从表示 Unicode 标量值的指定 32 位无符号整数中创建 RuneCreates a Rune from the specified 32-bit unsigned integer that represents a Unicode scalar value.

Rune(Char, Char) Rune(Char, Char) Rune(Char, Char) Rune(Char, Char)

从提供的 UTF-16 代理项对中创建 RuneCreates a Rune from the provided UTF-16 surrogate pair.

属性

IsAscii IsAscii IsAscii IsAscii

获取一个值,该值指示与此 Rune 关联的标量值是否在 ASCII 编码范围内。Gets a value that indicates whether the scalar value associated with this Rune is within the ASCII encoding range.

IsBmp IsBmp IsBmp IsBmp

获取一个值,该值指示与此 Rune 关联的标量值是否在 BMP 编码范围内。Gets a value that indicates whether the scalar value associated with this Rune is within the BMP encoding range.

Plane Plane Plane Plane

获取包含此标量的 Unicode 平面(0 至 16,含 0 和 16)。Gets the Unicode plane (0 to 16, inclusive) that contains this scalar.

ReplacementChar ReplacementChar ReplacementChar ReplacementChar

获取表示 Unicode 替换字符 U+FFFD 的 Rune 实例。Gets a Rune instance that represents the Unicode replacement character U+FFFD.

Utf16SequenceLength Utf16SequenceLength Utf16SequenceLength Utf16SequenceLength

获取表示此标量值所需的 UTF-16 序列的代码单元 (Char) 中的长度。Gets the length in code units (Char) of the UTF-16 sequence required to represent this scalar value.

Utf8SequenceLength Utf8SequenceLength Utf8SequenceLength Utf8SequenceLength

获取表示此标量值所需的 UTF-8 序列的代码单元中的长度。Gets the length in code units of the UTF-8 sequence required to represent this scalar value.

Value Value Value Value

获取整数形式的 Unicode 标量值。Gets the Unicode scalar value as an integer.

方法

CompareTo(Rune) CompareTo(Rune) CompareTo(Rune) CompareTo(Rune)

将当前实例与指定的 Rune 实例进行比较。Compares the current instance to the specified Rune instance.

DecodeFromUtf16(ReadOnlySpan<Char>, Rune, Int32) DecodeFromUtf16(ReadOnlySpan<Char>, Rune, Int32) DecodeFromUtf16(ReadOnlySpan<Char>, Rune, Int32) DecodeFromUtf16(ReadOnlySpan<Char>, Rune, Int32)

在提供的 UTF-16 源缓冲区开始处解码 RuneDecodes the Rune at the beginning of the provided UTF-16 source buffer.

DecodeFromUtf8(ReadOnlySpan<Byte>, Rune, Int32) DecodeFromUtf8(ReadOnlySpan<Byte>, Rune, Int32) DecodeFromUtf8(ReadOnlySpan<Byte>, Rune, Int32) DecodeFromUtf8(ReadOnlySpan<Byte>, Rune, Int32)

在提供的 UTF-8 源缓冲区开始处解码 RuneDecodes the Rune at the beginning of the provided UTF-8 source buffer.

DecodeLastFromUtf16(ReadOnlySpan<Char>, Rune, Int32) DecodeLastFromUtf16(ReadOnlySpan<Char>, Rune, Int32) DecodeLastFromUtf16(ReadOnlySpan<Char>, Rune, Int32) DecodeLastFromUtf16(ReadOnlySpan<Char>, Rune, Int32)

在提供的 UTF-16 源缓冲区结尾处解码 RuneDecodes the Rune at the end of the provided UTF-16 source buffer.

DecodeLastFromUtf8(ReadOnlySpan<Byte>, Rune, Int32) DecodeLastFromUtf8(ReadOnlySpan<Byte>, Rune, Int32) DecodeLastFromUtf8(ReadOnlySpan<Byte>, Rune, Int32) DecodeLastFromUtf8(ReadOnlySpan<Byte>, Rune, Int32)

在提供的 UTF-8 源缓冲区结尾处解码 RuneDecodes the Rune at the end of the provided UTF-8 source buffer.

EncodeToUtf16(Span<Char>) EncodeToUtf16(Span<Char>) EncodeToUtf16(Span<Char>) EncodeToUtf16(Span<Char>)

将此 Rune 解码为 UTF-16 目标缓冲区。Encodes this Rune to a UTF-16 destination buffer.

EncodeToUtf8(Span<Byte>) EncodeToUtf8(Span<Byte>) EncodeToUtf8(Span<Byte>) EncodeToUtf8(Span<Byte>)

将此 Rune 解码为 UTF-8 目标缓冲区。Encodes this Rune to a UTF-8 destination buffer.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

返回一个指示当前实例是否与指定对象相等的值。Returns a value that indicates whether the current instance and a specified object are equal.

Equals(Rune) Equals(Rune) Equals(Rune) Equals(Rune)

返回一个值,该值指示当前实例是否与指定的 rune 相等。Returns a value that indicates whether the current instance and a specified rune are equal.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

返回此实例的哈希代码。Returns the hash code for this instance.

GetNumericValue(Rune) GetNumericValue(Rune) GetNumericValue(Rune) GetNumericValue(Rune)

获取与指定 rune 关联的数值。Gets the numeric value associated with the specified rune.

GetRuneAt(String, Int32) GetRuneAt(String, Int32) GetRuneAt(String, Int32) GetRuneAt(String, Int32)

获取在字符串中指定位置开始的 RuneGets the Rune that begins at a specified position in a string.

GetUnicodeCategory(Rune) GetUnicodeCategory(Rune) GetUnicodeCategory(Rune) GetUnicodeCategory(Rune)

获取与指定 rune 关联的 Unicode 类别。Gets the Unicode category associated with the specified rune.

IsControl(Rune) IsControl(Rune) IsControl(Rune) IsControl(Rune)

返回一个值,该值指示指定的 rune 是否属于控制字符类别。Returns a value that indicates whether the specified rune is categorized as a control character.

IsDigit(Rune) IsDigit(Rune) IsDigit(Rune) IsDigit(Rune)

返回一个值,该值指示指定的 rune 是否属于十进制数字类别。Returns a value that indicates whether the specified rune is categorized as a decimal digit.

IsLetter(Rune) IsLetter(Rune) IsLetter(Rune) IsLetter(Rune)

返回一个值,该值指示指定的 rune 是否属于字母类别。Returns a value that indicates whether the specified rune is categorized as a letter.

IsLetterOrDigit(Rune) IsLetterOrDigit(Rune) IsLetterOrDigit(Rune) IsLetterOrDigit(Rune)

返回一个值,该值指示指定的 rune 属于字母类别还是十进制数字类别。Returns a value that indicates whether the specified rune is categorized as a letter or a decimal digit.

IsLower(Rune) IsLower(Rune) IsLower(Rune) IsLower(Rune)

返回一个值,该值指示指定的 rune 是否属于小写字母类别。Returns a value that indicates whether the specified rune is categorized as a lowercase letter.

IsNumber(Rune) IsNumber(Rune) IsNumber(Rune) IsNumber(Rune)

返回一个值,该值指示指定的 rune 是否属于数字类别。Returns a value that indicates whether the specified rune is categorized as a number.

IsPunctuation(Rune) IsPunctuation(Rune) IsPunctuation(Rune) IsPunctuation(Rune)

返回一个值,该值指示指定的 rune 是否属于标点符号类别。Returns a value that indicates whether the specified rune is categorized as a punctuation mark.

IsSeparator(Rune) IsSeparator(Rune) IsSeparator(Rune) IsSeparator(Rune)

返回一个值,该值指示指定的 rune 是否属于分隔符类别。Returns a value that indicates whether the specified rune is categorized as a separator character.

IsSymbol(Rune) IsSymbol(Rune) IsSymbol(Rune) IsSymbol(Rune)

返回一个值,该值指示指定的 rune 是否属于符号字符类别。Returns a value that indicates whether the specified rune is categorized as a symbol character.

IsUpper(Rune) IsUpper(Rune) IsUpper(Rune) IsUpper(Rune)

返回一个值,该值指示指定的 rune 是否属于大写字母类别。Returns a value that indicates whether the specified rune is categorized as an uppercase letter.

IsValid(Int32) IsValid(Int32) IsValid(Int32) IsValid(Int32)

返回一个值,该值指示 32 位带符号整数是否表示有效的 Unicode 标量值;即它在 [ U+0000..U+D7FF ](含首尾值)或 [ U+E000..U+10FFFF ](含首尾值)范围内。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) IsValid(UInt32) IsValid(UInt32) IsValid(UInt32)

返回一个值,该值指示 32 位无符号整数是否表示有效的 Unicode 标量值;即它在 [ U+0000..U+D7FF ](含首尾值)或 [ U+E000..U+10FFFF ](含首尾值)范围内。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) IsWhiteSpace(Rune) IsWhiteSpace(Rune) IsWhiteSpace(Rune)

返回一个值,该值指示指定的 rune 是否属于空格字符类别。Returns a value that indicates whether the specified rune is categorized as a white space character.

ToLower(Rune, CultureInfo) ToLower(Rune, CultureInfo) ToLower(Rune, CultureInfo) ToLower(Rune, CultureInfo)

根据指定区域性的大小写规则返回指定 Rune 转换为小写形式的副本。Returns a copy of the specified Rune converted to lowercase, using the casing rules of the specified culture.

ToLowerInvariant(Rune) ToLowerInvariant(Rune) ToLowerInvariant(Rune) ToLowerInvariant(Rune)

根据固定区域性的大小写规则返回指定 Rune 转换为小写形式的副本。Returns a copy of the specified Rune converted to lowercase using the casing rules of the invariant culture.

ToString() ToString() ToString() ToString()

返回此 Rune 实例的字符串表示形式。Returns the string representation of this Rune instance.

ToUpper(Rune, CultureInfo) ToUpper(Rune, CultureInfo) ToUpper(Rune, CultureInfo) ToUpper(Rune, CultureInfo)

根据指定区域性的大小写规则返回指定 Rune 转换为大写形式的副本。Returns a copy of the specified Rune converted to uppercase, using the casing rules of the specified culture.

ToUpperInvariant(Rune) ToUpperInvariant(Rune) ToUpperInvariant(Rune) ToUpperInvariant(Rune)

根据固定区域性的大小写规则返回指定 Rune 转换为大写形式的副本。Returns a copy of the specified Rune converted to uppercase using the casing rules of the invariant culture.

TryCreate(Char, Rune) TryCreate(Char, Rune) TryCreate(Char, Rune) TryCreate(Char, Rune)

尝试从指定的字符中创建 Rune,并返回指示操作是否成功的值。Attempts to create a Rune from a specified character and returns a value that indicates whether the operation succeeded.

TryCreate(Int32, Rune) TryCreate(Int32, Rune) TryCreate(Int32, Rune) TryCreate(Int32, Rune)

尝试从表示 Unicode 标量值的指定带符号整数中创建 RuneAttempts to create a Rune from a specified signed integer that represents a Unicode scalar value.

TryCreate(UInt32, Rune) TryCreate(UInt32, Rune) TryCreate(UInt32, Rune) TryCreate(UInt32, Rune)

尝试从表示 Unicode 标量值的指定 32 位无符号整数中创建 RuneAttempts to create a Rune from the specified 32-bit unsigned integer that represents a Unicode scalar value.

TryCreate(Char, Char, Rune) TryCreate(Char, Char, Rune) TryCreate(Char, Char, Rune) TryCreate(Char, Char, Rune)

尝试从指定的 UTF-16 代理项对中创建 Rune,并返回指示操作是否成功的值。Attempts to create a Rune from the specified UTF-16 surrogate pair and returns a value that indicates whether the operation was successful.

TryEncodeToUtf16(Span<Char>, Int32) TryEncodeToUtf16(Span<Char>, Int32) TryEncodeToUtf16(Span<Char>, Int32) TryEncodeToUtf16(Span<Char>, Int32)

将此 Rune 解码为 UTF-16 编码目标缓冲区。Encodes this Rune to a UTF-16 encoded destination buffer.

TryEncodeToUtf8(Span<Byte>, Int32) TryEncodeToUtf8(Span<Byte>, Int32) TryEncodeToUtf8(Span<Byte>, Int32) TryEncodeToUtf8(Span<Byte>, Int32)

将此 Rune 解码为 UTF-8 编码目标缓冲区。Encodes this Rune to a UTF-8 encoded destination buffer.

TryGetRuneAt(String, Int32, Rune) TryGetRuneAt(String, Int32, Rune) TryGetRuneAt(String, Int32, Rune) TryGetRuneAt(String, Int32, Rune)

尝试获取在字符串的指定位置处开始的 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.

操作员

Equality(Rune, Rune) Equality(Rune, Rune) Equality(Rune, Rune) Equality(Rune, Rune)

返回一个值,该值指示两个 Rune 实例是否相等。Returns a value that indicates whether two Rune instances are equal.

Explicit(Char to Rune) Explicit(Char to Rune) Explicit(Char to Rune) Explicit(Char to Rune)

定义从 16 位 Unicode 字符到 Rune 的显式转换。Defines an explicit conversion of a 16-bit Unicode character to a Rune.

Explicit(Int32 to Rune) Explicit(Int32 to Rune) Explicit(Int32 to Rune) Explicit(Int32 to Rune)

定义从 32 位带符号整数到 Rune 的显式转换。Defines an explicit conversion of a 32-bit signed integer to a Rune.

Explicit(UInt32 to Rune) Explicit(UInt32 to Rune) Explicit(UInt32 to Rune) Explicit(UInt32 to Rune)

定义从 32 位无符号整数到 Rune 的显式转换。Defines an explicit conversion of a 32-bit unsigned integer to a Rune.

GreaterThan(Rune, Rune) GreaterThan(Rune, Rune) GreaterThan(Rune, Rune) GreaterThan(Rune, Rune)

返回一个值,该值指示指定的 Rune 是否大于另一个指定的 RuneReturns a value indicating whether a specified Rune is greater than another specified Rune.

GreaterThanOrEqual(Rune, Rune) GreaterThanOrEqual(Rune, Rune) GreaterThanOrEqual(Rune, Rune) GreaterThanOrEqual(Rune, Rune)

返回一个值,该值指示指定的 Rune 是否大于等于另一个指定的 RuneReturns a value indicating whether a specified Rune is greater than or equal to another specified Rune.

Inequality(Rune, Rune) Inequality(Rune, Rune) Inequality(Rune, Rune) Inequality(Rune, Rune)

返回一个值,该值指示两个 Rune 实例是否具有不同的值。Returns a value that indicates whether two Rune instances have different values.

LessThan(Rune, Rune) LessThan(Rune, Rune) LessThan(Rune, Rune) LessThan(Rune, Rune)

返回一个值,该值指示指定的 Rune 是否小于另一个指定的 RuneReturns a value indicating whether a specified Rune is less than another specified Rune.

LessThanOrEqual(Rune, Rune) LessThanOrEqual(Rune, Rune) LessThanOrEqual(Rune, Rune) LessThanOrEqual(Rune, Rune)

返回一个值,该值指示指定的 Rune 是小于还是等于另一个指定的 RuneReturns a value indicating whether a specified Rune is less than or equal to another specified Rune.

适用于