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
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
explicit operator Rune(char)
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.