struct in Unity.Collections
Implements interfaces:IIndexable<T0>, INativeList<T0>, IUTF8Bytes
An unmanaged UTF-8 string whose content is stored directly in the 32-byte struct.
The binary layout of this string is guaranteed, for now and all time, to be a length (a little-endian two byte integer)
followed by the bytes of the characters (with no padding). A zero byte always immediately follows the last character.
Effectively, the number of bytes for storing characters is 3 less than 32 (two length bytes and one null byte).
This layout is identical to a FixedList32Bytes<T0> of bytes, thus allowing reinterpretation between FixedString32Bytes and FixedList32Bytes.
By virtue of being an unmanaged, non-allocated struct with no pointers, this string is fully compatible with jobs and Burst compilation.
Unlike managed string types, these strings can be put in any unmanaged ECS components, FixedList, or any other unmanaged structs.
| Property | Description |
|---|---|
| UTF8MaxLengthInBytes | Returns the maximum number of UTF-8 bytes that can be stored in this string. |
| Property | Description |
|---|---|
| Capacity | The number of bytes this string has for storing UTF-8 characters. |
| IsEmpty | Returns true if this string is empty (has no characters). |
| Length | The current length in bytes of this string's content. |
| this[int] | Returns the byte (not character) at an index. |
| Value | For internal use only. Use FixedString32Bytes.ToString instead. |
| Constructor | Description |
|---|---|
| FixedString32Bytes | Initializes and returns an instance of FixedString32Bytes with the characters copied from a string. |
| Method | Description |
|---|---|
| Add | Appends a byte. |
| AsFixedList | Returns a reference to a FixedList32Bytes<byte> representation of this string. |
| Clear | Sets the length to 0. |
| CompareTo | Returns the lexicographical sort order of this string relative to another. |
| ElementAt | Returns the reference to a byte (not character) at an index. |
| Equals | Returns true if this string and another have the same length and all the same characters. |
| GetEnumerator | Returns an enumerator for iterating over the characters of this string. |
| GetHashCode | Returns a hash code of this string. |
| GetUnsafePtr | Returns a pointer to the character bytes. |
| ToString | Returns a new managed string that is a copy of this string. |
| TryResize | Attempts to set the length in bytes. Does nothing if the new length is invalid. |
| Operator | Description |
|---|---|
| FixedString128Bytes | Returns a new FixedString128Bytes that is a copy of another string. |
| FixedString32Bytes | Returns a new FixedString32Bytes that is a copy of another string. |
| FixedString4096Bytes | Returns a new FixedString4096Bytes that is a copy of another string. |
| FixedString512Bytes | Returns a new FixedString512Bytes that is a copy of another string. |
| FixedString64Bytes | Returns a new FixedString64Bytes that is a copy of another string. |
| operator != | Returns true if a FixedString32Bytes and another string are unequal. |
| operator == | Returns true if a FixedString32Bytes and another string are equal. |