Struct FixedString512
An unmanaged string in UTF-8 format that contains its own fixed-size buffer of the given size in bytes. The string is NOT guaranteed to be null-terminated, though in many cases it may be by accident. No memory is ever allocated, and no attempt is made to share memory when strings are copied. Since this structure is not generic and needs no disposing, it can exist inside ECS components, can be put in a FixedArray, FixedList or FixedHashMap, and can be a data member of unmanaged structs that are allocated from the unmanaged heap. This string is entirely compatible with Burst compilation.
The binary layout of this string is guaranteed, for now and all time, to be two bytes of little-endian length, followed by a contiguous array of bytes with that length, with no padding in between. This is intentionally identical to FixedList of byte, which is guaranteed to always have the same memory layout.
Those who need more than 65,535 contiguous items should allocate from the heap, as storing that many things contiguously in a C# struct is likely to result in much wasted time, as the compiler copies the struct often.
Namespace: Unity.Collections
Syntax
public struct FixedString512 : INativeList<byte>, IComparable<string>, IEquatable<string>, IEquatable<FixedString32>, IEquatable<FixedString64>, IEquatable<FixedString128>, IEquatable<FixedString512>, IEquatable<FixedString4096>
Constructors
FixedString512(Char, Int32)
Construct a FixedString512 that is a single UCS-2 character, repeated multiple times. Keep in mind that UCS-2 is incapable of expressing emoji, rare Chinese characters, and various other things.
Declaration
public FixedString512(char c, int count)
Parameters
Type | Name | Description |
---|---|---|
Char | c | The UCS-2 character to repeat |
Int32 | count | The number of times to repeat the UCS character |
FixedString512(String)
Construct a FixedString512 from a System.String object.
Declaration
public FixedString512(string source)
Parameters
Type | Name | Description |
---|---|---|
String | source | The System.String object to construct this FixedString512 with |
FixedString512(FixedString128)
Construct a FixedString512 from a FixedString128
Declaration
public FixedString512(in FixedString128 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString128 | source | The 128 to construct this string from |
FixedString512(FixedString32)
Construct a FixedString512 from a FixedString32
Declaration
public FixedString512(in FixedString32 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString32 | source | The 32 to construct this string from |
FixedString512(FixedString4096)
Construct a FixedString512 from a FixedString4096
Declaration
public FixedString512(in FixedString4096 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString4096 | source | The 4096 to construct this string from |
FixedString512(FixedString64)
Construct a FixedString512 from a FixedString64
Declaration
public FixedString512(in FixedString64 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString64 | source | The 64 to construct this string from |
FixedString512(Unicode.Rune, Int32)
Construct a FixedString512 that is a single Unicode.Rune, repeated multiple times.
Declaration
public FixedString512(Unicode.Rune rune, int count)
Parameters
Type | Name | Description |
---|---|---|
Unicode.Rune | rune | The Unicode.Rune to repeat |
Int32 | count | The number of times to repeat the Unicode.Rune |
Fields
UTF8MaxLengthInBytes
The maximum length of the string, in bytes.
Declaration
public const int UTF8MaxLengthInBytes = 510
Field Value
Type | Description |
---|---|
Int32 |
Properties
AsFixedList
When it's desirable to manipulate the string as an array of UTF-8 bytes, this property reinterprets the FixedString512 as a FixedListByte512, which has the same memory layout.
Declaration
public FixedListByte512 AsFixedList { get; }
Property Value
Type | Description |
---|---|
FixedListByte512 |
Capacity
Declaration
public int Capacity { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Implements
IsEmpty
Reports whether container is empty.
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
Boolean | True if this container empty. |
Item[Int32]
Declaration
public byte this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Property Value
Type | Description |
---|---|
Byte |
Implements
Length
Declaration
public int Length { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Implements
UTF8LengthInBytes
The current length of the string, in bytes. As the string is encoded as UTF-8, each code point may be from 1 to 4 bytes in size. The string is not null-terminated, though it may sometimes be.
Declaration
public int UTF8LengthInBytes { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
Append(Int32)
Append the UTF-8 representation of a given integer to the contents of this FixedString512.
Declaration
public FormatError Append(int input)
Parameters
Type | Name | Description |
---|---|---|
Int32 | input | The integer to append as UTF-8 to the contents of this FixedString512 |
Returns
Type | Description |
---|---|
FormatError | An error code, if any, in the case that the append fails. |
Append(Int64)
Append the UTF-8 representation of a given long integer to the contents of this FixedString512.
Declaration
public FormatError Append(long input)
Parameters
Type | Name | Description |
---|---|---|
Int64 | input | The long integer to append as UTF-8 to the contents of this FixedString512 |
Returns
Type | Description |
---|---|
FormatError | An error code, if any, in the case that the append fails. |
Append(Single, Char)
Append the UTF-8 representation of a given float to the contents of this FixedString512.
Declaration
public FormatError Append(float input, char decimalSeparator = '.')
Parameters
Type | Name | Description |
---|---|---|
Single | input | The float to append as UTF-8 to the contents of this FixedString512 |
Char | decimalSeparator | The character used to separate the integral part from the fractional part. In the USA this is a period by default, and in Europe it is a comma by default. |
Returns
Type | Description |
---|---|
FormatError | An error code, if any, in the case that the format fails. |
Append(FixedString128)
Append a FixedString128 to the end of this FixedString512.
Declaration
public CopyError Append(in FixedString128 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString128 | source | The 128 to append to the end of this string |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
Append(FixedString32)
Append a FixedString32 to the end of this FixedString512.
Declaration
public CopyError Append(in FixedString32 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString32 | source | The 32 to append to the end of this string |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
Append(FixedString4096)
Append a FixedString4096 to the end of this FixedString512.
Declaration
public CopyError Append(in FixedString4096 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString4096 | source | The 4096 to append to the end of this string |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
Append(FixedString512)
Append a FixedString512 to the end of this FixedString512.
Declaration
public CopyError Append(in FixedString512 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | source | The 512 to append to the end of this string |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
Append(FixedString64)
Append a FixedString64 to the end of this FixedString512.
Declaration
public CopyError Append(in FixedString64 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString64 | source | The 64 to append to the end of this string |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
AppendFrom(FixedString128)
Append a FixedString128 to the end of this FixedString512.
Declaration
public CopyError AppendFrom(in FixedString128 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString128 | source | The 128 to append to the end of this string |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
AppendFrom(FixedString32)
Append a FixedString32 to the end of this FixedString512.
Declaration
public CopyError AppendFrom(in FixedString32 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString32 | source | The 32 to append to the end of this string |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
AppendFrom(FixedString4096)
Append a FixedString4096 to the end of this FixedString512.
Declaration
public CopyError AppendFrom(in FixedString4096 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString4096 | source | The 4096 to append to the end of this string |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
AppendFrom(FixedString512)
Append a FixedString512 to the end of this FixedString512.
Declaration
public CopyError AppendFrom(in FixedString512 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | source | The 512 to append to the end of this string |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
AppendFrom(FixedString64)
Append a FixedString64 to the end of this FixedString512.
Declaration
public CopyError AppendFrom(in FixedString64 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString64 | source | The 64 to append to the end of this string |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
AppendTo(Byte*, ref UInt16, UInt16)
Append this FixedString512 into a buffer of UTF-8 data.
Declaration
public CopyError AppendTo(byte *d, ref ushort length, ushort maxLength)
Parameters
Type | Name | Description |
---|---|---|
Byte* | d | A pointer to the UTF-8 buffer destination for the append |
UInt16 | length | The length, in bytes, of the data that already exists in the UTF-8 buffer |
UInt16 | maxLength | The maximum number of bytes that the destination buffer can hold |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
AppendTo(Char*, ref UInt16, UInt16)
Append this FixedString512 into a buffer of UTF-16 data.
Declaration
public CopyError AppendTo(char *d, ref ushort length, ushort maxLength)
Parameters
Type | Name | Description |
---|---|---|
Char* | d | A pointer to the UTF-16 buffer destination for the copy |
UInt16 | length | The length, in 16-bit units, of the data appended to the destination buffer |
UInt16 | maxLength | The maximum number of 16-bit units that the destination buffer can hold |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
CompareTo(String)
Compare this FixedString512 with a System.String in terms of lexigraphical order, and return which of the two strings would come first if sorted.
Declaration
public int CompareTo(string other)
Parameters
Type | Name | Description |
---|---|---|
String | other | The System.String to compare with |
Returns
Type | Description |
---|---|
Int32 | -1 if this FixedString512 would appear first if sorted, 0 if they are identical, or 1 if the other System.String would appear first if sorted. |
CompareTo(FixedString512)
Compare this FixedString512 with a FixedString512 in terms of lexigraphical order, and return which of the two strings would come first if sorted.
Declaration
public int CompareTo(FixedString512 other)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | other | The FixedString to compare with |
Returns
Type | Description |
---|---|
Int32 | -1 if this FixedString512 would appear first if sorted, 0 if they are identical, or 1 if the other System.String would appear first if sorted. |
Contains(FixedString128)
Search this string for the first occurrence of a FixedString128, and return whether the FixedString128 was found or not.
Declaration
public bool Contains(in FixedString128 other)
Parameters
Type | Name | Description |
---|---|---|
FixedString128 | other | The FixedString128 to search for |
Returns
Type | Description |
---|---|
Boolean | true if the FixedString128 was found, and false if not. |
Contains(FixedString32)
Search this string for the first occurrence of a FixedString32, and return whether the FixedString32 was found or not.
Declaration
public bool Contains(in FixedString32 other)
Parameters
Type | Name | Description |
---|---|---|
FixedString32 | other | The FixedString32 to search for |
Returns
Type | Description |
---|---|
Boolean | true if the FixedString32 was found, and false if not. |
Contains(FixedString4096)
Search this string for the first occurrence of a FixedString4096, and return whether the FixedString4096 was found or not.
Declaration
public bool Contains(in FixedString4096 other)
Parameters
Type | Name | Description |
---|---|---|
FixedString4096 | other | The FixedString4096 to search for |
Returns
Type | Description |
---|---|
Boolean | true if the FixedString4096 was found, and false if not. |
Contains(FixedString512)
Search this string for the first occurrence of a FixedString512, and return whether the FixedString512 was found or not.
Declaration
public bool Contains(in FixedString512 other)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | other | The FixedString512 to search for |
Returns
Type | Description |
---|---|
Boolean | true if the FixedString512 was found, and false if not. |
Contains(FixedString64)
Search this string for the first occurrence of a FixedString64, and return whether the FixedString64 was found or not.
Declaration
public bool Contains(in FixedString64 other)
Parameters
Type | Name | Description |
---|---|---|
FixedString64 | other | The FixedString64 to search for |
Returns
Type | Description |
---|---|
Boolean | true if the FixedString64 was found, and false if not. |
CopyFrom(Byte*, UInt16)
Copy UTF-8 data from a buffer onto this FixedString512.
Declaration
public CopyError CopyFrom(byte *s, ushort length)
Parameters
Type | Name | Description |
---|---|---|
Byte* | s | A pointer to the UTF-8 data to copy |
UInt16 | length | The length, in 8-bit bytes, of the UTF-8 data to copy |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
CopyFrom(Char*, UInt16)
Copy UTF-16 data from a buffer onto this FixedString512.
Declaration
public CopyError CopyFrom(char *s, ushort length)
Parameters
Type | Name | Description |
---|---|---|
Char* | s | A pointer to the UTF-16 data to copy |
UInt16 | length | The length, in 16-bit words, of the UTF-16 data to copy |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
CopyFrom(String)
Copy UTF-16 data from a System.String onto this FixedString512.
Declaration
public CopyError CopyFrom(string source)
Parameters
Type | Name | Description |
---|---|---|
String | source | The System.String to copy onto this string |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
CopyFrom(FixedString128)
Copy a FixedString128 onto this FixedString512.
Declaration
public CopyError CopyFrom(in FixedString128 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString128 | source | The 128 to copy onto this string |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
CopyFrom(FixedString32)
Copy a FixedString32 onto this FixedString512.
Declaration
public CopyError CopyFrom(in FixedString32 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString32 | source | The 32 to copy onto this string |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
CopyFrom(FixedString4096)
Copy a FixedString4096 onto this FixedString512.
Declaration
public CopyError CopyFrom(in FixedString4096 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString4096 | source | The 4096 to copy onto this string |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
CopyFrom(FixedString512)
Copy a FixedString512 onto this FixedString512.
Declaration
public CopyError CopyFrom(in FixedString512 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | source | The 512 to copy onto this string |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
CopyFrom(FixedString64)
Copy a FixedString64 onto this FixedString512.
Declaration
public CopyError CopyFrom(in FixedString64 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString64 | source | The 64 to copy onto this string |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
CopyTo(Byte*, out UInt16, UInt16)
Copy this FixedString512 into a buffer of UTF-8 data.
Declaration
public CopyError CopyTo(byte *d, out ushort length, ushort maxLength)
Parameters
Type | Name | Description |
---|---|---|
Byte* | d | A pointer to the UTF-8 buffer destination for the copy |
UInt16 | length | The length, in bytes, of the data copied to the destination buffer |
UInt16 | maxLength | The maximum number of bytes that will be copied to the destination buffer |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
CopyTo(Char*, out UInt16, UInt16)
Copy this FixedString512 into a buffer of UTF-16 data.
Declaration
public CopyError CopyTo(char *d, out ushort length, ushort maxLength)
Parameters
Type | Name | Description |
---|---|---|
Char* | d | A pointer to the UTF-16 buffer destination for the copy |
UInt16 | length | The length, in 16-bit units, of the data copied to the destination buffer |
UInt16 | maxLength | The maximum number of 16-bit units that will be copied to the destination buffer |
Returns
Type | Description |
---|---|
CopyError | An error code, if any, in the case that the operation fails. |
EffectiveSizeOf()
Returns the effective size of this struct in bytes, considering only the bytes that are actually used to hold data. Since the string may be shorter or longer, the effective size may be smaller than the UnsafeUtility.SizeOf<FixedString512>() size. FixedBytes at the end of the structure outside of the effective size, may contain any value, but typically contain the value 0.
Declaration
public int EffectiveSizeOf()
Returns
Type | Description |
---|---|
Int32 | The effective size of this struct in bytes. |
ElementAt(Int32)
Declaration
public byte ElementAt(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
Byte |
Implements
Equals(Object)
Determines whether a FixedString512 has the same value as some other object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Overrides
Equals(String)
Compare this FixedString512 with a System.String, and return whether they contain the same string or not.
Declaration
public bool Equals(string other)
Parameters
Type | Name | Description |
---|---|---|
String | other | The System.String to compare with |
Returns
Type | Description |
---|---|
Boolean | true if they are equal, or false if they are not. |
Equals(FixedString128)
Compare this FixedString512 with a FixedString128, and return whether they contain the same string or not.
Declaration
public bool Equals(FixedString128 other)
Parameters
Type | Name | Description |
---|---|---|
FixedString128 | other | The FixedString128 to compare with |
Returns
Type | Description |
---|---|
Boolean | true if they are equal, or false if they are not. |
Equals(FixedString32)
Compare this FixedString512 with a FixedString32, and return whether they contain the same string or not.
Declaration
public bool Equals(FixedString32 other)
Parameters
Type | Name | Description |
---|---|---|
FixedString32 | other | The FixedString32 to compare with |
Returns
Type | Description |
---|---|
Boolean | true if they are equal, or false if they are not. |
Equals(FixedString4096)
Compare this FixedString512 with a FixedString4096, and return whether they contain the same string or not.
Declaration
public bool Equals(FixedString4096 other)
Parameters
Type | Name | Description |
---|---|---|
FixedString4096 | other | The FixedString4096 to compare with |
Returns
Type | Description |
---|---|
Boolean | true if they are equal, or false if they are not. |
Equals(FixedString512)
Compare this FixedString512 with a FixedString512, and return whether they contain the same string or not.
Declaration
public bool Equals(FixedString512 other)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | other | The FixedString512 to compare with |
Returns
Type | Description |
---|---|
Boolean | true if they are equal, or false if they are not. |
Equals(FixedString64)
Compare this FixedString512 with a FixedString64, and return whether they contain the same string or not.
Declaration
public bool Equals(FixedString64 other)
Parameters
Type | Name | Description |
---|---|---|
FixedString64 | other | The FixedString64 to compare with |
Returns
Type | Description |
---|---|
Boolean | true if they are equal, or false if they are not. |
EqualsIn(FixedString128)
Compare this FixedString512 with a FixedString128, and return whether they contain the same string or not.
Declaration
public bool EqualsIn(in FixedString128 other)
Parameters
Type | Name | Description |
---|---|---|
FixedString128 | other | The FixedString128 to compare with |
Returns
Type | Description |
---|---|
Boolean | true if they are equal, or false if they are not. |
EqualsIn(FixedString32)
Compare this FixedString512 with a FixedString32, and return whether they contain the same string or not.
Declaration
public bool EqualsIn(in FixedString32 other)
Parameters
Type | Name | Description |
---|---|---|
FixedString32 | other | The FixedString32 to compare with |
Returns
Type | Description |
---|---|
Boolean | true if they are equal, or false if they are not. |
EqualsIn(FixedString4096)
Compare this FixedString512 with a FixedString4096, and return whether they contain the same string or not.
Declaration
public bool EqualsIn(in FixedString4096 other)
Parameters
Type | Name | Description |
---|---|---|
FixedString4096 | other | The FixedString4096 to compare with |
Returns
Type | Description |
---|---|
Boolean | true if they are equal, or false if they are not. |
EqualsIn(FixedString512)
Compare this FixedString512 with a FixedString512, and return whether they contain the same string or not.
Declaration
public bool EqualsIn(in FixedString512 other)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | other | The FixedString512 to compare with |
Returns
Type | Description |
---|---|
Boolean | true if they are equal, or false if they are not. |
EqualsIn(FixedString64)
Compare this FixedString512 with a FixedString64, and return whether they contain the same string or not.
Declaration
public bool EqualsIn(in FixedString64 other)
Parameters
Type | Name | Description |
---|---|---|
FixedString64 | other | The FixedString64 to compare with |
Returns
Type | Description |
---|---|
Boolean | true if they are equal, or false if they are not. |
Format(Int32)
Overwrite the contents of this FixedString512 with the UTF-8 representation of a given integer.
Declaration
public FormatError Format(int input)
Parameters
Type | Name | Description |
---|---|---|
Int32 | input | The integer to write as UTF-8 |
Returns
Type | Description |
---|---|
FormatError | An error code, if any, in the case that the format fails. |
Format(Int64)
Overwrite the contents of this FixedString512 with the UTF-8 representation of a given long integer.
Declaration
public FormatError Format(long input)
Parameters
Type | Name | Description |
---|---|---|
Int64 | input | The long integer to write as UTF-8 |
Returns
Type | Description |
---|---|
FormatError | An error code, if any, in the case that the format fails. |
Format(Single, Char)
Overwrite the contents of this FixedString512 with the UTF-8 representation of a given float.
Declaration
public FormatError Format(float input, char decimalSeparator = '.')
Parameters
Type | Name | Description |
---|---|---|
Single | input | The float to write as UTF-8 |
Char | decimalSeparator | The character used to separate the integral part from the fractional part. In the USA this is a period by default, and in Europe it is a comma by default. |
Returns
Type | Description |
---|---|
FormatError | An error code, if any, in the case that the format fails. |
Format(FixedString128)
Overwrite the contents of this FixedString512 with the UTF-8 representation of a given long integer.
Declaration
public FormatError Format(in FixedString128 input)
Parameters
Type | Name | Description |
---|---|---|
FixedString128 | input | The long integer to write as UTF-8 |
Returns
Type | Description |
---|---|
FormatError | An error code, if any, in the case that the format fails. |
Format(FixedString32)
Overwrite the contents of this FixedString512 with the UTF-8 representation of a given long integer.
Declaration
public FormatError Format(in FixedString32 input)
Parameters
Type | Name | Description |
---|---|---|
FixedString32 | input | The long integer to write as UTF-8 |
Returns
Type | Description |
---|---|
FormatError | An error code, if any, in the case that the format fails. |
Format(FixedString4096)
Overwrite the contents of this FixedString512 with the UTF-8 representation of a given long integer.
Declaration
public FormatError Format(in FixedString4096 input)
Parameters
Type | Name | Description |
---|---|---|
FixedString4096 | input | The long integer to write as UTF-8 |
Returns
Type | Description |
---|---|
FormatError | An error code, if any, in the case that the format fails. |
Format(FixedString512)
Overwrite the contents of this FixedString512 with the UTF-8 representation of a given long integer.
Declaration
public FormatError Format(in FixedString512 input)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | input | The long integer to write as UTF-8 |
Returns
Type | Description |
---|---|
FormatError | An error code, if any, in the case that the format fails. |
Format(FixedString64)
Overwrite the contents of this FixedString512 with the UTF-8 representation of a given long integer.
Declaration
public FormatError Format(in FixedString64 input)
Parameters
Type | Name | Description |
---|---|---|
FixedString64 | input | The long integer to write as UTF-8 |
Returns
Type | Description |
---|---|
FormatError | An error code, if any, in the case that the format fails. |
GetEnumerator()
Returns an enumerator that iterates through a container.
Declaration
public FixedString512.Enumerator GetEnumerator()
Returns
Type | Description |
---|---|
FixedString512.Enumerator | An IEnumerator object that can be used to iterate through the container. |
GetHashCode()
Compute a hash code of this FixedString512: an integer that is likely to be different for two FixedString512, if their contents are different.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A hash code of this FixedString512 |
Overrides
IndexOf(FixedString128, Int32, Int32)
Search this string for the first occurrence of a FixedString128, and return the index of where it was found, if any.
Declaration
public int IndexOf(in FixedString128 other, int startIndex = 0, int count = 510)
Parameters
Type | Name | Description |
---|---|---|
FixedString128 | other | The FixedString128 to search for |
Int32 | startIndex | The byte index to begin searching from |
Int32 | count | The count of bytes to search from the starting index |
Returns
Type | Description |
---|---|
Int32 | -1 if the FixedString128 was not found. otherwise, the index of the first occurrence of the FixedString128 |
IndexOf(FixedString32, Int32, Int32)
Search this string for the first occurrence of a FixedString32, and return the index of where it was found, if any.
Declaration
public int IndexOf(in FixedString32 other, int startIndex = 0, int count = 510)
Parameters
Type | Name | Description |
---|---|---|
FixedString32 | other | The FixedString32 to search for |
Int32 | startIndex | The byte index to begin searching from |
Int32 | count | The count of bytes to search from the starting index |
Returns
Type | Description |
---|---|
Int32 | -1 if the FixedString32 was not found. otherwise, the index of the first occurrence of the FixedString32 |
IndexOf(FixedString4096, Int32, Int32)
Search this string for the first occurrence of a FixedString4096, and return the index of where it was found, if any.
Declaration
public int IndexOf(in FixedString4096 other, int startIndex = 0, int count = 510)
Parameters
Type | Name | Description |
---|---|---|
FixedString4096 | other | The FixedString4096 to search for |
Int32 | startIndex | The byte index to begin searching from |
Int32 | count | The count of bytes to search from the starting index |
Returns
Type | Description |
---|---|
Int32 | -1 if the FixedString4096 was not found. otherwise, the index of the first occurrence of the FixedString4096 |
IndexOf(FixedString512, Int32, Int32)
Search this string for the first occurrence of a FixedString512, and return the index of where it was found, if any.
Declaration
public int IndexOf(in FixedString512 other, int startIndex = 0, int count = 510)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | other | The FixedString512 to search for |
Int32 | startIndex | The byte index to begin searching from |
Int32 | count | The count of bytes to search from the starting index |
Returns
Type | Description |
---|---|
Int32 | -1 if the FixedString512 was not found. otherwise, the index of the first occurrence of the FixedString512 |
IndexOf(FixedString64, Int32, Int32)
Search this string for the first occurrence of a FixedString64, and return the index of where it was found, if any.
Declaration
public int IndexOf(in FixedString64 other, int startIndex = 0, int count = 510)
Parameters
Type | Name | Description |
---|---|---|
FixedString64 | other | The FixedString64 to search for |
Int32 | startIndex | The byte index to begin searching from |
Int32 | count | The count of bytes to search from the starting index |
Returns
Type | Description |
---|---|
Int32 | -1 if the FixedString64 was not found. otherwise, the index of the first occurrence of the FixedString64 |
IndexOf(Unicode.Rune, Int32, Int32)
Search this string for the first occurrence of a Unicode.Rune, and return the index of where it was found, if any.
Declaration
public int IndexOf(Unicode.Rune other, int startIndex = 0, int count = 510)
Parameters
Type | Name | Description |
---|---|---|
Unicode.Rune | other | The Uniode.Rune to search for |
Int32 | startIndex | The byte index to begin searching from |
Int32 | count | The count of bytes to search from the starting index |
Returns
Type | Description |
---|---|
Int32 | -1 if the Unicode.Rune was not found. otherwise, the index of the first occurrence of the Unicode.Rune |
LastIndexOf(FixedString128, Int32, Int32)
Search this string for the last occurrence of a FixedString128, and return the index of where it was found, if any.
Declaration
public int LastIndexOf(in FixedString128 other, int startIndex = 509, int count = 510)
Parameters
Type | Name | Description |
---|---|---|
FixedString128 | other | The FixedString128 to search for |
Int32 | startIndex | The byte index to begin searching backwards from |
Int32 | count | The count of bytes to search from the starting index backward |
Returns
Type | Description |
---|---|
Int32 | -1 if the FixedString128 was not found. otherwise, the index of the first occurrence of the FixedString128 |
LastIndexOf(FixedString32, Int32, Int32)
Search this string for the last occurrence of a FixedString32, and return the index of where it was found, if any.
Declaration
public int LastIndexOf(in FixedString32 other, int startIndex = 509, int count = 510)
Parameters
Type | Name | Description |
---|---|---|
FixedString32 | other | The FixedString32 to search for |
Int32 | startIndex | The byte index to begin searching backwards from |
Int32 | count | The count of bytes to search from the starting index backward |
Returns
Type | Description |
---|---|
Int32 | -1 if the FixedString32 was not found. otherwise, the index of the first occurrence of the FixedString32 |
LastIndexOf(FixedString4096, Int32, Int32)
Search this string for the last occurrence of a FixedString4096, and return the index of where it was found, if any.
Declaration
public int LastIndexOf(in FixedString4096 other, int startIndex = 509, int count = 510)
Parameters
Type | Name | Description |
---|---|---|
FixedString4096 | other | The FixedString4096 to search for |
Int32 | startIndex | The byte index to begin searching backwards from |
Int32 | count | The count of bytes to search from the starting index backward |
Returns
Type | Description |
---|---|
Int32 | -1 if the FixedString4096 was not found. otherwise, the index of the first occurrence of the FixedString4096 |
LastIndexOf(FixedString512, Int32, Int32)
Search this string for the last occurrence of a FixedString512, and return the index of where it was found, if any.
Declaration
public int LastIndexOf(in FixedString512 other, int startIndex = 509, int count = 510)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | other | The FixedString512 to search for |
Int32 | startIndex | The byte index to begin searching backwards from |
Int32 | count | The count of bytes to search from the starting index backward |
Returns
Type | Description |
---|---|
Int32 | -1 if the FixedString512 was not found. otherwise, the index of the first occurrence of the FixedString512 |
LastIndexOf(FixedString64, Int32, Int32)
Search this string for the last occurrence of a FixedString64, and return the index of where it was found, if any.
Declaration
public int LastIndexOf(in FixedString64 other, int startIndex = 509, int count = 510)
Parameters
Type | Name | Description |
---|---|---|
FixedString64 | other | The FixedString64 to search for |
Int32 | startIndex | The byte index to begin searching backwards from |
Int32 | count | The count of bytes to search from the starting index backward |
Returns
Type | Description |
---|---|
Int32 | -1 if the FixedString64 was not found. otherwise, the index of the first occurrence of the FixedString64 |
LastIndexOf(Unicode.Rune, Int32, Int32)
Search this string for the last occurrence of a Unicode.Rune, and return the index of where it was found, if any.
Declaration
public int LastIndexOf(Unicode.Rune other, int startIndex = 509, int count = 510)
Parameters
Type | Name | Description |
---|---|---|
Unicode.Rune | other | The Unicode.Rune to search for |
Int32 | startIndex | The byte index to begin searching backwards from |
Int32 | count | The count of bytes to search from the starting index backward |
Returns
Type | Description |
---|---|
Int32 | -1 if the Unicode.Rune was not found. otherwise, the index of the first occurrence of the Unicode.Rune |
Parse(ref Int32, ref Int32)
Parse an integer from this FixedString512, at the byte offset indicated from the beginning of the FixedString512.
Declaration
public ParseError Parse(ref int offset, ref int output)
Parameters
Type | Name | Description |
---|---|---|
Int32 | offset | The zero-based byte offset from the beginning of the string. |
Int32 | output | The integer so parsed, if any. |
Returns
Type | Description |
---|---|
ParseError | An error code, if any, in the case that the parse fails. |
Parse(ref Int32, ref Single, Char)
Parse a float from this FixedString512, at the byte offset indicated. The resulting float is intended to be bitwise-identical to the output of System.Single.Parse().
Declaration
public ParseError Parse(ref int offset, ref float output, char decimalSeparator = '.')
Parameters
Type | Name | Description |
---|---|---|
Int32 | offset | The zero-based byte offset from the beginning of the string. |
Single | output | The float so parsed, if any. |
Char | decimalSeparator | The character used to separate the integral part from the fractional part. In the USA this is a period by default, and in Europe it is a comma by default. |
Returns
Type | Description |
---|---|
ParseError | An error code, if any, in the case that the parse fails. |
ToString()
Convert this FixedString512 to a System.String.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | A System.String with a copy of this FixedString512 |
Overrides
Operators
Equality(FixedString512, FixedString128)
Determines whether a FixedString512 and FixedString128 have the same value.
Declaration
public static bool operator ==(in FixedString512 a, in FixedString128 b)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | a | The first string to compare for equality |
FixedString128 | b | The second string to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedString512, FixedString32)
Determines whether a FixedString512 and FixedString32 have the same value.
Declaration
public static bool operator ==(in FixedString512 a, in FixedString32 b)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | a | The first string to compare for equality |
FixedString32 | b | The second string to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedString512, FixedString4096)
Determines whether a FixedString512 and FixedString4096 have the same value.
Declaration
public static bool operator ==(in FixedString512 a, in FixedString4096 b)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | a | The first string to compare for equality |
FixedString4096 | b | The second string to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedString512, FixedString512)
Determines whether a FixedString512 and FixedString512 have the same value.
Declaration
public static bool operator ==(in FixedString512 a, in FixedString512 b)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | a | The first string to compare for equality |
FixedString512 | b | The second string to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedString512, FixedString64)
Determines whether a FixedString512 and FixedString64 have the same value.
Declaration
public static bool operator ==(in FixedString512 a, in FixedString64 b)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | a | The first string to compare for equality |
FixedString64 | b | The second string to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Implicit(String to FixedString512)
Enable implicit conversion of System.String to FixedString512.
Declaration
public static implicit operator FixedString512(string b)
Parameters
Type | Name | Description |
---|---|---|
String | b | The System.String object to convert to a FixedString512 |
Returns
Type | Description |
---|---|
FixedString512 |
Implicit(FixedString128 to FixedString512)
Enable implicit conversion of FixedString128 to FixedString512.
Declaration
public static implicit operator FixedString512(in FixedString128 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString128 | source |
Returns
Type | Description |
---|---|
FixedString512 |
Implicit(FixedString32 to FixedString512)
Enable implicit conversion of FixedString32 to FixedString512.
Declaration
public static implicit operator FixedString512(in FixedString32 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString32 | source |
Returns
Type | Description |
---|---|
FixedString512 |
Implicit(FixedString4096 to FixedString512)
Enable implicit conversion of FixedString4096 to FixedString512.
Declaration
public static implicit operator FixedString512(in FixedString4096 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString4096 | source |
Returns
Type | Description |
---|---|
FixedString512 |
Implicit(FixedString64 to FixedString512)
Enable implicit conversion of FixedString64 to FixedString512.
Declaration
public static implicit operator FixedString512(in FixedString64 source)
Parameters
Type | Name | Description |
---|---|---|
FixedString64 | source |
Returns
Type | Description |
---|---|
FixedString512 |
Inequality(FixedString512, FixedString128)
Determines whether a FixedString512 and FixedString128 have different values.
Declaration
public static bool operator !=(in FixedString512 a, in FixedString128 b)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | a | The first string to compare for inequality |
FixedString128 | b | The second string to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedString512, FixedString32)
Determines whether a FixedString512 and FixedString32 have different values.
Declaration
public static bool operator !=(in FixedString512 a, in FixedString32 b)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | a | The first string to compare for inequality |
FixedString32 | b | The second string to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedString512, FixedString4096)
Determines whether a FixedString512 and FixedString4096 have different values.
Declaration
public static bool operator !=(in FixedString512 a, in FixedString4096 b)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | a | The first string to compare for inequality |
FixedString4096 | b | The second string to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedString512, FixedString512)
Determines whether a FixedString512 and FixedString512 have different values.
Declaration
public static bool operator !=(in FixedString512 a, in FixedString512 b)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | a | The first string to compare for inequality |
FixedString512 | b | The second string to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedString512, FixedString64)
Determines whether a FixedString512 and FixedString64 have different values.
Declaration
public static bool operator !=(in FixedString512 a, in FixedString64 b)
Parameters
Type | Name | Description |
---|---|---|
FixedString512 | a | The first string to compare for inequality |
FixedString64 | b | The second string to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |