docs.unity.cn
    Show / Hide Table of Contents

    Struct Unicode.Rune

    Representation of a Unicode character as a code point.

    Namespace: Unity.Collections
    Syntax
    public struct Rune

    Constructors

    Rune(Int32)

    Initializes and returns an instance of Rune.

    Declaration
    public Rune(int codepoint)
    Parameters
    Type Name Description
    Int32 codepoint

    The code point.

    Remarks

    You are responsible for the code point being valid.

    Fields

    value

    The code point.

    Declaration
    public int value
    Field Value
    Type Description
    Int32

    The code point.

    Methods

    Equals(Object)

    Returns true if the value stored in this Rune is equal to an object.

    Declaration
    [ExcludeFromBurstCompatTesting("Takes managed object")]
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj

    An object to compare with.

    Returns
    Type Description
    Boolean

    True if the value stored in this Rune is equal to the object.

    Overrides
    ValueType.Equals(Object)
    Remarks

    Can only be equal if the object is itself a Rune.

    GetHashCode()

    A hash used for comparisons.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    A unique hash code.

    Overrides
    ValueType.GetHashCode()

    IsDigit(Unicode.Rune)

    Returns true if a rune is a numerical digit character.

    Declaration
    public static bool IsDigit(Unicode.Rune r)
    Parameters
    Type Name Description
    Unicode.Rune r

    The rune.

    Returns
    Type Description
    Boolean

    True if the rune is a numerical digit character.

    LengthInUtf8Bytes()

    Returns the number of bytes required to encode this rune as UTF-8.

    Declaration
    public int LengthInUtf8Bytes()
    Returns
    Type Description
    Int32

    The number of bytes required to encode this rune as UTF-8. If the rune's codepoint is invalid, returns 4 (the maximum possible encoding length).

    Operators

    Equality(Unicode.Rune, Unicode.Rune)

    Evaluates if one is equal to the other.

    Declaration
    public static bool operator ==(Unicode.Rune lhs, Unicode.Rune rhs)
    Parameters
    Type Name Description
    Unicode.Rune lhs

    The left-hand side

    Unicode.Rune rhs

    The right-hand side

    Returns
    Type Description
    Boolean

    True if the left-hand side's is equal to the right-hand side's.

    Implicit(Char to Unicode.Rune)

    Returns a rune.

    Declaration
    public static implicit operator Unicode.Rune(char codepoint)
    Parameters
    Type Name Description
    Char codepoint

    A code point.

    Returns
    Type Description
    Unicode.Rune

    A rune.

    Remarks

    Because a char is 16-bit, it can only represent the first 2^16 code points, not all 1.1 million.

    Inequality(Unicode.Rune, Unicode.Rune)

    Evaluates if one is not equal to the other.

    Declaration
    public static bool operator !=(Unicode.Rune lhs, Unicode.Rune rhs)
    Parameters
    Type Name Description
    Unicode.Rune lhs

    The left-hand side

    Unicode.Rune rhs

    The right-hand side

    Returns
    Type Description
    Boolean

    True if the left-hand side's is not equal to the right-hand side's.

    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Thursday, May 11, 2023