文档

Unity Engine

Unity Engine

UnsafeText

An unmanaged, mutable, resizable UTF-8 string.
阅读时间1 分钟最后更新于 1 个月前

Definition

public struct UnsafeText : INativeDisposable, IDisposable, IUTF8Bytes, INativeList<byte>, IIndexable<byte>

Remarks

The string is always null-terminated, meaning a zero byte always immediately follows the last character.

Static Fields

Value

Description

MaxCapacityThe maximum number of elements this type of container can hold.

Constructors

Constructor

Description

UnsafeText(System.Int32,Unity.Collections.AllocatorManager.AllocatorHandle)Initializes and returns an instance of UnsafeText.

Properties

Property

Description

CapacityThe current capacity in bytes of this string.
IsCreatedWhether this string's character buffer has been allocated (and not yet deallocated).
IsEmptyReports whether container is empty.
this[]The byte at an index.
LengthThe current length in bytes of this string.

Methods

Method

Description

ClearSets the length to 0.
DisposeReleases all resources (memory).
ElementAtReturns a reference to the byte (not character) at an index.
GetUnsafePtrReturns a pointer to this string's character buffer.
ToStringReturns a managed string copy of this string.
TryResizeAttempt to set the length in bytes of this string.