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
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
Explicit(Char to Unicode.Rune)
Returns a rune.
Declaration
public static explicit 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.