Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


FixedString512Bytes

An unmanaged UTF-8 string whose content is stored directly in the 512-byte struct.
Read time 4 minutesLast updated 6 days ago

Definition

public struct FixedString512Bytes : INativeList<byte>, IIndexable<byte>, IUTF8Bytes, IComparable<string>, IEquatable<string>, IComparable<FixedString32Bytes>, IEquatable<FixedString32Bytes>, IComparable<FixedString64Bytes>, IEquatable<FixedString64Bytes>, IComparable<FixedString128Bytes>, IEquatable<FixedString128Bytes>, IComparable<FixedString512Bytes>, IEquatable<FixedString512Bytes>, IComparable<FixedString4096Bytes>, IEquatable<FixedString4096Bytes>

Remarks

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 512 (two length bytes and one null byte).
This layout is identical to a FixedList512Bytes<T> of bytes, thus allowing reinterpretation between FixedString512Bytes and FixedList512Bytes.
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.

Constructors

Constructor

Description

FixedString512Bytes(System.String)Initializes and returns an instance of FixedString512Bytes with the characters copied from a string.
FixedString512Bytes(Unity.Collections.FixedString128Bytes@)Initializes and returns an instance of FixedString512Bytes that is a copy of another string.
FixedString512Bytes(Unity.Collections.FixedString32Bytes@)Initializes and returns an instance of FixedString512Bytes that is a copy of another string.
FixedString512Bytes(Unity.Collections.FixedString4096Bytes@)Initializes and returns an instance of FixedString512Bytes that is a copy of another string.
FixedString512Bytes(Unity.Collections.FixedString512Bytes@)Initializes and returns an instance of FixedString512Bytes that is a copy of another string.
FixedString512Bytes(Unity.Collections.FixedString64Bytes@)Initializes and returns an instance of FixedString512Bytes that is a copy of another string.
FixedString512Bytes(Unity.Collections.LowLevel.Unsafe.UnsafeText@)Initializes and returns an instance of FixedString512Bytes that is a copy of another string.
FixedString512Bytes(Unity.Collections.NativeText.ReadOnly)Initializes and returns an instance of FixedString512Bytes with the characters copied from a string.
FixedString512Bytes(Unity.Collections.Unicode.Rune,System.Int32)Initializes and returns an instance of FixedString512Bytes with a single character repeatedly appended some number of times.

Properties

Property

Description

CapacityThe number of bytes this string has for storing UTF-8 characters.
IsEmptyReturns true if this string is empty (has no characters).
this[]Returns the byte (not character) at an index.
LengthThe current length in bytes of this string's content.
ValueFor internal use only. Use FixedString512Bytes.ToString instead.

Static Properties

Property

Description

UTF8MaxLengthInBytesReturns the maximum number of UTF-8 bytes that can be stored in this string.

Methods

Method

Description

AddAppends a byte.
AsFixedListReturns a reference to a FixedList512Bytes\<byte\> representation of this string.
ClearSets the length to 0.
CompareToReturns the lexicographical sort order of this string relative to another.
ElementAtReturns the reference to a byte (not character) at an index.
EqualsReturns true if this string and an object are equal.
GetEnumeratorReturns an enumerator for iterating over the characters of this string.
GetHashCodeReturns a hash code of this string.
GetUnsafePtrReturns a pointer to the character bytes.
ToStringReturns a new managed string that is a copy of this string.
TryResizeAttempts to set the length in bytes. Does nothing if the new length is invalid.

Operators

Operator

Description

operator ==Returns true if a FixedString512Bytes and another string are equal.
FixedString512BytesReturns a new FixedString512Bytes that is a copy of another string.
FixedString4096BytesReturns a new FixedString4096Bytes that is a copy of another string.
operator !=Returns true if a FixedString512Bytes and another string are unequal.

Structs

Struct

Description

FixedString512Bytes.EnumeratorAn enumerator over the characters (not bytes) of a FixedString512Bytes.