Struct NativeText
An unmanaged, mutable, resizable UTF-8 string.
Namespace: Unity.Collections
Assembly: solution.dll
Syntax
[NativeContainer]
public struct NativeText : INativeList<byte>, IIndexable<byte>, INativeDisposable, IUTF8Bytes
Remarks
The string is always null-terminated, meaning a zero byte always immediately follows the last character.
Constructors
| Name | Description |
|---|---|
| NativeText(int, Allocator) | Initializes and returns an instance of NativeText. |
| NativeText(int, AllocatorHandle) | Initializes and returns an instance of NativeText. |
| NativeText(string, Allocator) | Initializes and returns an instance of NativeText with the characters copied from another string. |
| NativeText(string, AllocatorHandle) | Initializes and returns an instance of NativeText with the characters copied from another string. |
| NativeText(Allocator) | Initializes and returns an instance of NativeText with an initial capacity of 512 bytes. |
| NativeText(AllocatorHandle) | Initializes and returns an instance of NativeText with an initial capacity of 512 bytes. |
| NativeText(in FixedString128Bytes, Allocator) | Initializes and returns an instance of NativeText with the characters copied from another string. |
| NativeText(in FixedString128Bytes, AllocatorHandle) | Initializes and returns an instance of NativeText with the characters copied from another string. |
| NativeText(in FixedString32Bytes, Allocator) | Initializes and returns an instance of NativeText with the characters copied from another string. |
| NativeText(in FixedString32Bytes, AllocatorHandle) | Initializes and returns an instance of NativeText with the characters copied from another string. |
| NativeText(in FixedString4096Bytes, Allocator) | Initializes and returns an instance of NativeText with the characters copied from another string. |
| NativeText(in FixedString4096Bytes, AllocatorHandle) | Initializes and returns an instance of NativeText with the characters copied from another string. |
| NativeText(in FixedString512Bytes, Allocator) | Initializes and returns an instance of NativeText with the characters copied from another string. |
| NativeText(in FixedString512Bytes, AllocatorHandle) | Initializes and returns an instance of NativeText with the characters copied from another string. |
| NativeText(in FixedString64Bytes, Allocator) | Initializes and returns an instance of NativeText with the characters copied from another string. |
| NativeText(in FixedString64Bytes, AllocatorHandle) | Initializes and returns an instance of NativeText with the characters copied from another string. |
Properties
| Name | Description |
|---|---|
| Capacity | The current capacity in bytes of this string. |
| IsCreated | Whether this string's character buffer has been allocated (and not yet deallocated). |
| IsEmpty | Whether this string has no characters. |
| this[int] | The byte at an index. Note that writing to a NativeText.Readonly is not supported; the setter of this property throws when safety checks are enabled. |
| Length | The current length in bytes of this string. |
Methods
| Name | Description |
|---|---|
| Add(in byte) | Appends a byte. |
| AsReadOnly() | Returns a readonly version of this NativeText instance. |
| Clear() | Sets the length to 0. |
| CompareTo(string) | Returns the lexicographical sort order of this string relative to another. |
| CompareTo(FixedString128Bytes) | Returns the lexicographical sort order of this string relative to another. |
| CompareTo(FixedString32Bytes) | Returns the lexicographical sort order of this string relative to another. |
| CompareTo(FixedString4096Bytes) | Returns the lexicographical sort order of this string relative to another. |
| CompareTo(FixedString512Bytes) | Returns the lexicographical sort order of this string relative to another. |
| CompareTo(FixedString64Bytes) | Returns the lexicographical sort order of this string relative to another. |
| CompareTo(NativeText) | Returns the lexicographical sort order of this string relative to another. |
| CompareTo(ReadOnly) | Returns the lexicographical sort order of this string relative to another. |
| Dispose() | Releases all resources (memory and safety handles). |
| Dispose(JobHandle) | Creates and schedules a job that releases all resources (memory and safety handles) of this NativeText. |
| ElementAt(int) | Returns a reference to the byte (not character) at an index. |
| Equals(object) | Returns true if this string and another object are equal. |
| Equals(string) | Returns true if this string and another are equal. |
| Equals(FixedString128Bytes) | Returns true if this string and another are equal. |
| Equals(FixedString32Bytes) | Returns true if this string and another are equal. |
| Equals(FixedString4096Bytes) | Returns true if this string and another are equal. |
| Equals(FixedString512Bytes) | Returns true if this string and another are equal. |
| Equals(FixedString64Bytes) | Returns true if this string and another are equal. |
| Equals(NativeText) | Returns true if this string and another are equal. |
| Equals(ReadOnly) | Returns true if this string and another are equal. |
| GetEnumerator() | Returns an enumerator for iterating over the characters of the NativeText. |
| GetHashCode() | Returns a hash code of this string. |
| GetUnsafePtr() | Returns a pointer to this string's character buffer. |
| ToString() | Returns a managed string copy of this string. |
| TryResize(int, NativeArrayOptions) | Attempt to set the length in bytes of this string. |
Operators
| Name | Description |
|---|---|
| operator ==(in NativeText, in FixedString128Bytes) | Returns true if two strings are equal. |
| operator ==(in NativeText, in FixedString32Bytes) | Returns true if two strings are equal. |
| operator ==(in NativeText, in FixedString4096Bytes) | Returns true if two strings are equal. |
| operator ==(in NativeText, in FixedString512Bytes) | Returns true if two strings are equal. |
| operator ==(in NativeText, in FixedString64Bytes) | Returns true if two strings are equal. |
| operator !=(in NativeText, in FixedString128Bytes) | Returns true if two strings are unequal. |
| operator !=(in NativeText, in FixedString32Bytes) | Returns true if two strings are unequal. |
| operator !=(in NativeText, in FixedString4096Bytes) | Returns true if two strings are unequal. |
| operator !=(in NativeText, in FixedString512Bytes) | Returns true if two strings are unequal. |
| operator !=(in NativeText, in FixedString64Bytes) | Returns true if two strings are unequal. |