Struct Unicode.Rune
Representation of a Unicode character as a code point.
Namespace: Unity.Collections
Assembly: Unity.Collections.dll
Syntax
public struct Unicode.Rune
Constructors
Rune(int)
Initializes and returns an instance of Rune.
Declaration
public Rune(int codepoint)
Parameters
Type | Name | Description |
---|---|---|
int | 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 |
---|---|
int | 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 |
---|---|
bool | True if the value stored in this Rune is equal to the object. |
Overrides
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 |
---|---|
int | A unique hash code. |
Overrides
IsDigit(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 |
---|---|
bool | 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 |
---|---|
int | 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
operator ==(Rune, 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 |
---|---|
bool | True if the left-hand side's is equal to the right-hand side's. |
implicit operator Rune(char)
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.
operator !=(Rune, 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 |
---|---|
bool | True if the left-hand side's is not equal to the right-hand side's. |