Class FixedStringMethods
Provides extension methods for FixedStringN.
Namespace: Unity.Collections
Assembly: Unity.Collections.dll
Syntax
public static class FixedStringMethods
Methods
AppendFormat<T, U, T0, T1, T2, T3, T4, T5, T6, T7>(ref T, in U, in T0, in T1, in T2, in T3, in T4, in T5, in T6, in T7)
Interpolates strings into a format string and appends the result to this string.
Declaration
public static void AppendFormat<T, U, T0, T1, T2, T3, T4, T5, T6, T7>(this ref T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5, in T6 arg6, in T7 arg7) where T : struct, INativeList<byte>, IUTF8Bytes where U : struct, INativeList<byte>, IUTF8Bytes where T0 : struct, INativeList<byte>, IUTF8Bytes where T1 : struct, INativeList<byte>, IUTF8Bytes where T2 : struct, INativeList<byte>, IUTF8Bytes where T3 : struct, INativeList<byte>, IUTF8Bytes where T4 : struct, INativeList<byte>, IUTF8Bytes where T5 : struct, INativeList<byte>, IUTF8Bytes where T6 : struct, INativeList<byte>, IUTF8Bytes where T7 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | dest | The string to append to. |
U | format | A string to be interpolated and appended. |
T0 | arg0 | A FixedStringNBytes to interpolate into the format string. |
T1 | arg1 | A FixedStringNBytes to interpolate into the format string. |
T2 | arg2 | A FixedStringNBytes to interpolate into the format string. |
T3 | arg3 | A FixedStringNBytes to interpolate into the format string. |
T4 | arg4 | A FixedStringNBytes to interpolate into the format string. |
T5 | arg5 | A FixedStringNBytes to interpolate into the format string. |
T6 | arg6 | A FixedStringNBytes to interpolate into the format string. |
T7 | arg7 | A FixedStringNBytes to interpolate into the format string. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringNBytes type. |
U | A FixedStringNBytes type. |
T0 | The type of value to interpolate into the format string. |
T1 | The type of value to interpolate into the format string. |
T2 | The type of value to interpolate into the format string. |
T3 | The type of value to interpolate into the format string. |
T4 | The type of value to interpolate into the format string. |
T5 | The type of value to interpolate into the format string. |
T6 | The type of value to interpolate into the format string. |
T7 | The type of value to interpolate into the format string. |
Remarks
Similar to StringBuilder.AppendFormat
but with significant limitations:
- Only supports FixedStringNBytes arguments. To use other string types, convert them to FixedStringNBytes first.
- Only supports numeric format placeholders of the form
{0}
..{N}
. - No format modifiers (e.g.
{0:x}
) are supported.
The overloads of this method take up to ten strings to interpolate into the format string.
AppendFormat<T, U, T0, T1, T2, T3, T4, T5, T6, T7, T8>(ref T, in U, in T0, in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8)
Interpolates strings into a format string and appends the result to this string.
Declaration
public static void AppendFormat<T, U, T0, T1, T2, T3, T4, T5, T6, T7, T8>(this ref T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5, in T6 arg6, in T7 arg7, in T8 arg8) where T : struct, INativeList<byte>, IUTF8Bytes where U : struct, INativeList<byte>, IUTF8Bytes where T0 : struct, INativeList<byte>, IUTF8Bytes where T1 : struct, INativeList<byte>, IUTF8Bytes where T2 : struct, INativeList<byte>, IUTF8Bytes where T3 : struct, INativeList<byte>, IUTF8Bytes where T4 : struct, INativeList<byte>, IUTF8Bytes where T5 : struct, INativeList<byte>, IUTF8Bytes where T6 : struct, INativeList<byte>, IUTF8Bytes where T7 : struct, INativeList<byte>, IUTF8Bytes where T8 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | dest | The string to append to. |
U | format | A string to be interpolated and appended. |
T0 | arg0 | A FixedStringNBytes to interpolate into the format string. |
T1 | arg1 | A FixedStringNBytes to interpolate into the format string. |
T2 | arg2 | A FixedStringNBytes to interpolate into the format string. |
T3 | arg3 | A FixedStringNBytes to interpolate into the format string. |
T4 | arg4 | A FixedStringNBytes to interpolate into the format string. |
T5 | arg5 | A FixedStringNBytes to interpolate into the format string. |
T6 | arg6 | A FixedStringNBytes to interpolate into the format string. |
T7 | arg7 | A FixedStringNBytes to interpolate into the format string. |
T8 | arg8 | A FixedStringNBytes to interpolate into the format string. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringNBytes type. |
U | A FixedStringNBytes type. |
T0 | The type of value to interpolate into the format string. |
T1 | The type of value to interpolate into the format string. |
T2 | The type of value to interpolate into the format string. |
T3 | The type of value to interpolate into the format string. |
T4 | The type of value to interpolate into the format string. |
T5 | The type of value to interpolate into the format string. |
T6 | The type of value to interpolate into the format string. |
T7 | The type of value to interpolate into the format string. |
T8 | The type of value to interpolate into the format string. |
Remarks
Similar to StringBuilder.AppendFormat
but with significant limitations:
- Only supports FixedStringNBytes arguments. To use other string types, convert them to FixedStringNBytes first.
- Only supports numeric format placeholders of the form
{0}
..{N}
. - No format modifiers (e.g.
{0:x}
) are supported.
The overloads of this method take up to ten strings to interpolate into the format string.
AppendFormat<T, U, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(ref T, in U, in T0, in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9)
Interpolates strings into a format string and appends the result to this string.
Declaration
public static void AppendFormat<T, U, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(this ref T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5, in T6 arg6, in T7 arg7, in T8 arg8, in T9 arg9) where T : struct, INativeList<byte>, IUTF8Bytes where U : struct, INativeList<byte>, IUTF8Bytes where T0 : struct, INativeList<byte>, IUTF8Bytes where T1 : struct, INativeList<byte>, IUTF8Bytes where T2 : struct, INativeList<byte>, IUTF8Bytes where T3 : struct, INativeList<byte>, IUTF8Bytes where T4 : struct, INativeList<byte>, IUTF8Bytes where T5 : struct, INativeList<byte>, IUTF8Bytes where T6 : struct, INativeList<byte>, IUTF8Bytes where T7 : struct, INativeList<byte>, IUTF8Bytes where T8 : struct, INativeList<byte>, IUTF8Bytes where T9 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | dest | The string to append to. |
U | format | A string to be interpolated and appended. |
T0 | arg0 | A FixedStringNBytes to interpolate into the format string. |
T1 | arg1 | A FixedStringNBytes to interpolate into the format string. |
T2 | arg2 | A FixedStringNBytes to interpolate into the format string. |
T3 | arg3 | A FixedStringNBytes to interpolate into the format string. |
T4 | arg4 | A FixedStringNBytes to interpolate into the format string. |
T5 | arg5 | A FixedStringNBytes to interpolate into the format string. |
T6 | arg6 | A FixedStringNBytes to interpolate into the format string. |
T7 | arg7 | A FixedStringNBytes to interpolate into the format string. |
T8 | arg8 | A FixedStringNBytes to interpolate into the format string. |
T9 | arg9 | A FixedStringNBytes to interpolate into the format string. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringNBytes type. |
U | A FixedStringNBytes type. |
T0 | The type of value to interpolate into the format string. |
T1 | The type of value to interpolate into the format string. |
T2 | The type of value to interpolate into the format string. |
T3 | The type of value to interpolate into the format string. |
T4 | The type of value to interpolate into the format string. |
T5 | The type of value to interpolate into the format string. |
T6 | The type of value to interpolate into the format string. |
T7 | The type of value to interpolate into the format string. |
T8 | The type of value to interpolate into the format string. |
T9 | The type of value to interpolate into the format string. |
Remarks
Similar to StringBuilder.AppendFormat
but with significant limitations:
- Only supports FixedStringNBytes arguments. To use other string types, convert them to FixedStringNBytes first.
- Only supports numeric format placeholders of the form
{0}
..{N}
. - No format modifiers (e.g.
{0:x}
) are supported.
The overloads of this method take up to ten strings to interpolate into the format string.
AppendFormat<T, U, T0>(ref T, in U, in T0)
Interpolates strings into a format string and appends the result to this string.
Declaration
public static void AppendFormat<T, U, T0>(this ref T dest, in U format, in T0 arg0) where T : struct, INativeList<byte>, IUTF8Bytes where U : struct, INativeList<byte>, IUTF8Bytes where T0 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | dest | The string to append to. |
U | format | A string to be interpolated and appended. |
T0 | arg0 | A FixedStringNBytes to interpolate into the format string. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringNBytes type. |
U | A FixedStringNBytes type. |
T0 | The type of value to interpolate into the format string. |
Remarks
Similar to StringBuilder.AppendFormat
but with significant limitations:
- Only supports FixedStringNBytes arguments. To use other string types, convert them to FixedStringNBytes first.
- Only supports numeric format placeholders of the form
{0}
..{N}
. - No format modifiers (e.g.
{0:x}
) are supported.
The overloads of this method take up to ten strings to interpolate into the format string.
AppendFormat<T, U, T0, T1>(ref T, in U, in T0, in T1)
Interpolates strings into a format string and appends the result to this string.
Declaration
public static void AppendFormat<T, U, T0, T1>(this ref T dest, in U format, in T0 arg0, in T1 arg1) where T : struct, INativeList<byte>, IUTF8Bytes where U : struct, INativeList<byte>, IUTF8Bytes where T0 : struct, INativeList<byte>, IUTF8Bytes where T1 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | dest | The string to append to. |
U | format | A string to be interpolated and appended. |
T0 | arg0 | A FixedStringNBytes to interpolate into the format string. |
T1 | arg1 | A FixedStringNBytes to interpolate into the format string. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringNBytes type. |
U | A FixedStringNBytes type. |
T0 | The type of value to interpolate into the format string. |
T1 | The type of value to interpolate into the format string. |
Remarks
Similar to StringBuilder.AppendFormat
but with significant limitations:
- Only supports FixedStringNBytes arguments. To use other string types, convert them to FixedStringNBytes first.
- Only supports numeric format placeholders of the form
{0}
..{N}
. - No format modifiers (e.g.
{0:x}
) are supported.
The overloads of this method take up to ten strings to interpolate into the format string.
AppendFormat<T, U, T0, T1, T2>(ref T, in U, in T0, in T1, in T2)
Interpolates strings into a format string and appends the result to this string.
Declaration
public static void AppendFormat<T, U, T0, T1, T2>(this ref T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2) where T : struct, INativeList<byte>, IUTF8Bytes where U : struct, INativeList<byte>, IUTF8Bytes where T0 : struct, INativeList<byte>, IUTF8Bytes where T1 : struct, INativeList<byte>, IUTF8Bytes where T2 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | dest | The string to append to. |
U | format | A string to be interpolated and appended. |
T0 | arg0 | A FixedStringNBytes to interpolate into the format string. |
T1 | arg1 | A FixedStringNBytes to interpolate into the format string. |
T2 | arg2 | A FixedStringNBytes to interpolate into the format string. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringNBytes type. |
U | A FixedStringNBytes type. |
T0 | The type of value to interpolate into the format string. |
T1 | The type of value to interpolate into the format string. |
T2 | The type of value to interpolate into the format string. |
Remarks
Similar to StringBuilder.AppendFormat
but with significant limitations:
- Only supports FixedStringNBytes arguments. To use other string types, convert them to FixedStringNBytes first.
- Only supports numeric format placeholders of the form
{0}
..{N}
. - No format modifiers (e.g.
{0:x}
) are supported.
The overloads of this method take up to ten strings to interpolate into the format string.
AppendFormat<T, U, T0, T1, T2, T3>(ref T, in U, in T0, in T1, in T2, in T3)
Interpolates strings into a format string and appends the result to this string.
Declaration
public static void AppendFormat<T, U, T0, T1, T2, T3>(this ref T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3) where T : struct, INativeList<byte>, IUTF8Bytes where U : struct, INativeList<byte>, IUTF8Bytes where T0 : struct, INativeList<byte>, IUTF8Bytes where T1 : struct, INativeList<byte>, IUTF8Bytes where T2 : struct, INativeList<byte>, IUTF8Bytes where T3 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | dest | The string to append to. |
U | format | A string to be interpolated and appended. |
T0 | arg0 | A FixedStringNBytes to interpolate into the format string. |
T1 | arg1 | A FixedStringNBytes to interpolate into the format string. |
T2 | arg2 | A FixedStringNBytes to interpolate into the format string. |
T3 | arg3 | A FixedStringNBytes to interpolate into the format string. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringNBytes type. |
U | A FixedStringNBytes type. |
T0 | The type of value to interpolate into the format string. |
T1 | The type of value to interpolate into the format string. |
T2 | The type of value to interpolate into the format string. |
T3 | The type of value to interpolate into the format string. |
Remarks
Similar to StringBuilder.AppendFormat
but with significant limitations:
- Only supports FixedStringNBytes arguments. To use other string types, convert them to FixedStringNBytes first.
- Only supports numeric format placeholders of the form
{0}
..{N}
. - No format modifiers (e.g.
{0:x}
) are supported.
The overloads of this method take up to ten strings to interpolate into the format string.
AppendFormat<T, U, T0, T1, T2, T3, T4>(ref T, in U, in T0, in T1, in T2, in T3, in T4)
Interpolates strings into a format string and appends the result to this string.
Declaration
public static void AppendFormat<T, U, T0, T1, T2, T3, T4>(this ref T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4) where T : struct, INativeList<byte>, IUTF8Bytes where U : struct, INativeList<byte>, IUTF8Bytes where T0 : struct, INativeList<byte>, IUTF8Bytes where T1 : struct, INativeList<byte>, IUTF8Bytes where T2 : struct, INativeList<byte>, IUTF8Bytes where T3 : struct, INativeList<byte>, IUTF8Bytes where T4 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | dest | The string to append to. |
U | format | A string to be interpolated and appended. |
T0 | arg0 | A FixedStringNBytes to interpolate into the format string. |
T1 | arg1 | A FixedStringNBytes to interpolate into the format string. |
T2 | arg2 | A FixedStringNBytes to interpolate into the format string. |
T3 | arg3 | A FixedStringNBytes to interpolate into the format string. |
T4 | arg4 | A FixedStringNBytes to interpolate into the format string. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringNBytes type. |
U | A FixedStringNBytes type. |
T0 | The type of value to interpolate into the format string. |
T1 | The type of value to interpolate into the format string. |
T2 | The type of value to interpolate into the format string. |
T3 | The type of value to interpolate into the format string. |
T4 | The type of value to interpolate into the format string. |
Remarks
Similar to StringBuilder.AppendFormat
but with significant limitations:
- Only supports FixedStringNBytes arguments. To use other string types, convert them to FixedStringNBytes first.
- Only supports numeric format placeholders of the form
{0}
..{N}
. - No format modifiers (e.g.
{0:x}
) are supported.
The overloads of this method take up to ten strings to interpolate into the format string.
AppendFormat<T, U, T0, T1, T2, T3, T4, T5>(ref T, in U, in T0, in T1, in T2, in T3, in T4, in T5)
Interpolates strings into a format string and appends the result to this string.
Declaration
public static void AppendFormat<T, U, T0, T1, T2, T3, T4, T5>(this ref T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5) where T : struct, INativeList<byte>, IUTF8Bytes where U : struct, INativeList<byte>, IUTF8Bytes where T0 : struct, INativeList<byte>, IUTF8Bytes where T1 : struct, INativeList<byte>, IUTF8Bytes where T2 : struct, INativeList<byte>, IUTF8Bytes where T3 : struct, INativeList<byte>, IUTF8Bytes where T4 : struct, INativeList<byte>, IUTF8Bytes where T5 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | dest | The string to append to. |
U | format | A string to be interpolated and appended. |
T0 | arg0 | A FixedStringNBytes to interpolate into the format string. |
T1 | arg1 | A FixedStringNBytes to interpolate into the format string. |
T2 | arg2 | A FixedStringNBytes to interpolate into the format string. |
T3 | arg3 | A FixedStringNBytes to interpolate into the format string. |
T4 | arg4 | A FixedStringNBytes to interpolate into the format string. |
T5 | arg5 | A FixedStringNBytes to interpolate into the format string. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringNBytes type. |
U | A FixedStringNBytes type. |
T0 | The type of value to interpolate into the format string. |
T1 | The type of value to interpolate into the format string. |
T2 | The type of value to interpolate into the format string. |
T3 | The type of value to interpolate into the format string. |
T4 | The type of value to interpolate into the format string. |
T5 | The type of value to interpolate into the format string. |
Remarks
Similar to StringBuilder.AppendFormat
but with significant limitations:
- Only supports FixedStringNBytes arguments. To use other string types, convert them to FixedStringNBytes first.
- Only supports numeric format placeholders of the form
{0}
..{N}
. - No format modifiers (e.g.
{0:x}
) are supported.
The overloads of this method take up to ten strings to interpolate into the format string.
AppendFormat<T, U, T0, T1, T2, T3, T4, T5, T6>(ref T, in U, in T0, in T1, in T2, in T3, in T4, in T5, in T6)
Interpolates strings into a format string and appends the result to this string.
Declaration
public static void AppendFormat<T, U, T0, T1, T2, T3, T4, T5, T6>(this ref T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5, in T6 arg6) where T : struct, INativeList<byte>, IUTF8Bytes where U : struct, INativeList<byte>, IUTF8Bytes where T0 : struct, INativeList<byte>, IUTF8Bytes where T1 : struct, INativeList<byte>, IUTF8Bytes where T2 : struct, INativeList<byte>, IUTF8Bytes where T3 : struct, INativeList<byte>, IUTF8Bytes where T4 : struct, INativeList<byte>, IUTF8Bytes where T5 : struct, INativeList<byte>, IUTF8Bytes where T6 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | dest | The string to append to. |
U | format | A string to be interpolated and appended. |
T0 | arg0 | A FixedStringNBytes to interpolate into the format string. |
T1 | arg1 | A FixedStringNBytes to interpolate into the format string. |
T2 | arg2 | A FixedStringNBytes to interpolate into the format string. |
T3 | arg3 | A FixedStringNBytes to interpolate into the format string. |
T4 | arg4 | A FixedStringNBytes to interpolate into the format string. |
T5 | arg5 | A FixedStringNBytes to interpolate into the format string. |
T6 | arg6 | A FixedStringNBytes to interpolate into the format string. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringNBytes type. |
U | A FixedStringNBytes type. |
T0 | The type of value to interpolate into the format string. |
T1 | The type of value to interpolate into the format string. |
T2 | The type of value to interpolate into the format string. |
T3 | The type of value to interpolate into the format string. |
T4 | The type of value to interpolate into the format string. |
T5 | The type of value to interpolate into the format string. |
T6 | The type of value to interpolate into the format string. |
Remarks
Similar to StringBuilder.AppendFormat
but with significant limitations:
- Only supports FixedStringNBytes arguments. To use other string types, convert them to FixedStringNBytes first.
- Only supports numeric format placeholders of the form
{0}
..{N}
. - No format modifiers (e.g.
{0:x}
) are supported.
The overloads of this method take up to ten strings to interpolate into the format string.
AppendRawByte<T>(ref T, byte)
Appends a byte to this string.
Declaration
public static FormatError AppendRawByte<T>(this ref T fs, byte a) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A FixedStringNBytes. |
byte | a | A byte to append. |
Returns
Type | Description |
---|---|
FormatError | FormatError.None if successful. Returns FormatError.Overflow if the capacity of the string is exceeded. |
Type Parameters
Name | Description |
---|---|
T | The type of FixedStringNBytes. |
Remarks
No validation is performed: it is your responsibility for the data to be valid UTF-8 when you're done appending bytes.
Append<T>(ref T, byte*, int)
Appends bytes to this string.
Declaration
public static FormatError Append<T>(this ref T fs, byte* utf8Bytes, int utf8BytesLength) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | The destination string. |
byte* | utf8Bytes | The bytes to append. |
int | utf8BytesLength | The number of bytes to append. |
Returns
Type | Description |
---|---|
FormatError | FormatError.None if successful. Returns FormatError.Overflow if the capacity of the destination string is exceeded. |
Type Parameters
Name | Description |
---|---|
T | The type of the destination string. |
Remarks
When the method returns an error, the destination string is not modified.
No validation is performed: it is your responsibility for the destination to contain valid UTF-8 when you're done appending bytes.
Append<T>(ref T, char)
Appends a char to this string.
Declaration
public static FormatError Append<T>(this ref T fs, char ch) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A FixedStringNBytes. |
char | ch | A char to append. |
Returns
Type | Description |
---|---|
FormatError | FormatError.None if successful. Returns FormatError.Overflow if the capacity of the string is exceeded. |
Type Parameters
Name | Description |
---|---|
T | The type of FixedStringNBytes. |
Append<T>(ref T, int)
Appends a number (converted to UTF-8 characters) to this string.
Declaration
public static FormatError Append<T>(this ref T fs, int input) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A FixedStringNBytes. |
int | input | An int to append to the string. |
Returns
Type | Description |
---|---|
FormatError | FormatError.None if successful. Returns FormatError.Overflow if the capacity of the string is exceeded. |
Type Parameters
Name | Description |
---|---|
T | The type of FixedStringNBytes. |
Append<T>(ref T, long)
Appends a number (converted to UTF-8 characters) to this string.
Declaration
public static FormatError Append<T>(this ref T fs, long input) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A FixedStringNBytes. |
long | input | A long integer to append to the string. |
Returns
Type | Description |
---|---|
FormatError | FormatError.None if successful. Returns FormatError.Overflow if the capacity of the string is exceeded. |
Type Parameters
Name | Description |
---|---|
T | The type of FixedStringNBytes. |
Append<T>(ref T, float, char)
Appends a number (converted to UTF-8 characters) to this string.
Declaration
public static FormatError Append<T>(this ref T fs, float input, char decimalSeparator = '.') where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A FixedStringNBytes. |
float | input | A float to append to the string. |
char | decimalSeparator | The character to use as the decimal separator. Defaults to a period ('.'). |
Returns
Type | Description |
---|---|
FormatError | FormatError.None if successful. Returns FormatError.Overflow if the capacity of the string is exceeded. |
Type Parameters
Name | Description |
---|---|
T | The type of FixedStringNBytes. |
Append<T>(ref T, string)
Appends another string to this string.
Declaration
public static FormatError Append<T>(this ref T fs, string s) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | The destination string. |
string | s | The string to append. |
Returns
Type | Description |
---|---|
FormatError | FormatError.None if successful. Returns FormatError.Overflow if the capacity of the destination string is exceeded. |
Type Parameters
Name | Description |
---|---|
T | The type of the destination string. |
Remarks
When the method returns an error, the destination string is not modified.
Append<T>(ref T, uint)
Appends a number (converted to UTF-8 characters) to this string.
Declaration
public static FormatError Append<T>(this ref T fs, uint input) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A FixedStringNBytes. |
uint | input | A uint to append to the string. |
Returns
Type | Description |
---|---|
FormatError | FormatError.None if successful. Returns FormatError.Overflow if the capacity of the string is exceeded. |
Type Parameters
Name | Description |
---|---|
T | The type of FixedStringNBytes. |
Append<T>(ref T, ulong)
Appends a number (converted to UTF-8 characters) to this string.
Declaration
public static FormatError Append<T>(this ref T fs, ulong input) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A FixedStringNBytes. |
ulong | input | A ulong integer to append to the string. |
Returns
Type | Description |
---|---|
FormatError | FormatError.None if successful. Returns FormatError.Overflow if the capacity of the string is exceeded. |
Type Parameters
Name | Description |
---|---|
T | The type of FixedStringNBytes. |
Append<T>(ref T, Rune)
Appends a Unicode.Rune to this string.
Declaration
public static FormatError Append<T>(this ref T fs, Unicode.Rune rune) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A FixedStringNBytes. |
Unicode.Rune | rune | A Unicode.Rune to append. |
Returns
Type | Description |
---|---|
FormatError | FormatError.None if successful. Returns FormatError.Overflow if the capacity of the string is exceeded. |
Type Parameters
Name | Description |
---|---|
T | The type of FixedStringNBytes. |
Append<T>(ref T, Rune, int)
Appends a Unicode.Rune a number of times to this string.
Declaration
public static FormatError Append<T>(this ref T fs, Unicode.Rune rune, int count) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A FixedStringNBytes. |
Unicode.Rune | rune | A Unicode.Rune to append some number of times. |
int | count | The number of times to append the rune. |
Returns
Type | Description |
---|---|
FormatError | FormatError.None if successful. Returns FormatError.Overflow if the capacity of the string is exceeded. |
Type Parameters
Name | Description |
---|---|
T | The type of FixedStringNBytes. |
Append<T, T2>(ref T, in T2)
Appends another string to this string.
Declaration
public static FormatError Append<T, T2>(this ref T fs, in T2 input) where T : struct, INativeList<byte>, IUTF8Bytes where T2 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | The destination string. |
T2 | input | The source string. |
Returns
Type | Description |
---|---|
FormatError | FormatError.None if successful. Returns FormatError.Overflow if the capacity of the destination string is exceeded. |
Type Parameters
Name | Description |
---|---|
T | The type of the destination string. |
T2 | The type of the source string. |
Remarks
When the method returns an error, the destination string is not modified.
CompareTo<T>(ref T, byte*, int)
Returns the sort position of this string relative to a byte sequence.
Declaration
public static int CompareTo<T>(this ref T fs, byte* bytes, int bytesLen) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to compare. |
byte* | bytes | A byte sequence to compare. |
int | bytesLen | The number of bytes in the byte sequence. |
Returns
Type | Description |
---|---|
int | A number denoting the sort position of this string relative to the byte sequence:
|
Type Parameters
Name | Description |
---|---|
T | A FixedStringN type. |
CompareTo<T, T2>(ref T, in T2)
Returns the sort position of this string relative to another.
Declaration
public static int CompareTo<T, T2>(this ref T fs, in T2 other) where T : struct, INativeList<byte>, IUTF8Bytes where T2 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to compare. |
T2 | other | Another string to compare. |
Returns
Type | Description |
---|---|
int | A number denoting the relative sort position of the strings:
|
Type Parameters
Name | Description |
---|---|
T | A FixedStringN type. |
T2 | A FixedStringN type. |
ComputeHashCode<T>(ref T)
Returns a hash code of this string.
Declaration
public static int ComputeHashCode<T>(this ref T fs) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to get a hash code of. |
Returns
Type | Description |
---|---|
int | A hash code of this string. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringN type. |
Contains<T, T2>(ref T, in T2)
Returns true if a given substring occurs within this string.
Declaration
public static bool Contains<T, T2>(this ref T fs, in T2 other) where T : struct, INativeList<byte>, IUTF8Bytes where T2 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to search. |
T2 | other | A substring to search for within this string. |
Returns
Type | Description |
---|---|
bool | True if the substring occurs within this string. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringN type. |
T2 | A FixedStringN type. |
ConvertToString<T>(ref T)
Returns a copy of this string as a managed string.
Declaration
public static string ConvertToString<T>(this ref T fs) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to copy. |
Returns
Type | Description |
---|---|
string | A copy of this string as a managed string. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringN type. |
CopyFromTruncated<T>(ref T, string)
Copies another string to this string. If the string exceeds the capacity it will be truncated.
Declaration
public static void CopyFromTruncated<T>(this ref T fs, string s) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | The destination string. |
string | s | The source string. |
Type Parameters
Name | Description |
---|---|
T | The type of the destination string. |
CopyFrom<T>(ref T, string)
Copies another string to this string (making the two strings equal).
Declaration
public static CopyError CopyFrom<T>(this ref T fs, string s) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | The destination string. |
string | s | The source string. |
Returns
Type | Description |
---|---|
CopyError | CopyError.None if successful. Returns CopyError.Truncation if the source string is too large to fit in the destination. |
Type Parameters
Name | Description |
---|---|
T | The type of the destination string. |
Remarks
When the method returns an error, the destination string is not modified.
CopyFrom<T, T2>(ref T, in T2)
Copies another string to this string (making the two strings equal).
Declaration
public static CopyError CopyFrom<T, T2>(this ref T fs, in T2 input) where T : struct, INativeList<byte>, IUTF8Bytes where T2 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | The destination string. |
T2 | input | The source string. |
Returns
Type | Description |
---|---|
CopyError | CopyError.None if successful. Returns CopyError.Truncation if the source string is too large to fit in the destination. |
Type Parameters
Name | Description |
---|---|
T | The type of the destination string. |
T2 | The type of the source string. |
Remarks
When the method returns an error, the destination string is not modified.
EffectiveSizeOf<T>(ref T)
Returns the effective size in bytes of this string.
Declaration
public static int EffectiveSizeOf<T>(this ref T fs) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to get the effective size of. |
Returns
Type | Description |
---|---|
int | The effective size in bytes of this string. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringN type. |
Remarks
"Effective size" is Length + 3
, the number of bytes you need to copy when serializing the string.
(The plus 3 accounts for the null-terminator byte and the 2 bytes that store the Length).
Useful for checking whether this string will fit in the space of a smaller FixedStringN.
Equals<T>(ref T, byte*, int)
Returns true if this string and a byte sequence are equal (meaning they have the same length and content).
Declaration
public static bool Equals<T>(this ref T fs, byte* bytes, int bytesLen) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to compare for equality. |
byte* | bytes | A sequence of bytes to compare for equality. |
int | bytesLen | The number of bytes in the byte sequence. |
Returns
Type | Description |
---|---|
bool | True if this string and the byte sequence have the same length and if this string's character bytes match the byte sequence. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringN type. |
Equals<T, T2>(ref T, in T2)
Returns true if this string is equal to another.
Declaration
public static bool Equals<T, T2>(this ref T fs, in T2 other) where T : struct, INativeList<byte>, IUTF8Bytes where T2 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to compare for equality. |
T2 | other | Another string to compare for equality. |
Returns
Type | Description |
---|---|
bool | true if the two strings have the same length and matching content. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringN type. |
T2 | A FixedStringN type. |
IndexOf<T>(ref T, byte*, int)
Returns the index of the first occurrence of a byte sequence in this string.
Declaration
public static int IndexOf<T>(this ref T fs, byte* bytes, int bytesLen) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to search. |
byte* | bytes | A byte sequence to search for within this string. |
int | bytesLen | The number of bytes in the byte sequence. |
Returns
Type | Description |
---|---|
int | The index of the first occurrence of the byte sequence in this string. Returns -1 if no occurrence is found. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringN type. |
IndexOf<T>(ref T, byte*, int, int, int)
Returns the index of the first occurrence of a byte sequence within a subrange of this string.
Declaration
public static int IndexOf<T>(this ref T fs, byte* bytes, int bytesLen, int startIndex, int distance = 2147483647) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to search. |
byte* | bytes | A byte sequence to search for within this string. |
int | bytesLen | The number of bytes in the byte sequence. |
int | startIndex | The first index in this string to consider as the first byte of the byte sequence. |
int | distance | The last index in this string to consider as the first byte of the byte sequence. |
Returns
Type | Description |
---|---|
int | The index of the first occurrence of the byte sequence in this string. Returns -1 if no occurrence is found. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringN type. |
IndexOf<T, T2>(ref T, in T2)
Returns the index of the first occurrence of a substring within this string.
Declaration
public static int IndexOf<T, T2>(this ref T fs, in T2 other) where T : struct, INativeList<byte>, IUTF8Bytes where T2 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to search. |
T2 | other | A substring to search for within this string. |
Returns
Type | Description |
---|---|
int | The index of the first occurrence of the second string within this string. Returns -1 if no occurrence is found. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringN type. |
T2 | A FixedStringN type. |
IndexOf<T, T2>(ref T, in T2, int, int)
Returns the index of the first occurrence of a substring within a subrange of this string.
Declaration
public static int IndexOf<T, T2>(this ref T fs, in T2 other, int startIndex, int distance = 2147483647) where T : struct, INativeList<byte>, IUTF8Bytes where T2 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to search. |
T2 | other | A substring to search for within this string. |
int | startIndex | The first index in this string to consider as an occurrence of the second string. |
int | distance | The last index in this string to consider as an occurrence of the second string. |
Returns
Type | Description |
---|---|
int | The index of the first occurrence of the substring within this string. Returns -1 if no occurrence is found. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringN type. |
T2 | A FixedStringN type. |
LastIndexOf<T>(ref T, byte*, int)
Returns the index of the last occurrence of a byte sequence within this string.
Declaration
public static int LastIndexOf<T>(this ref T fs, byte* bytes, int bytesLen) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to search. |
byte* | bytes | A byte sequence to search for within this string. |
int | bytesLen | The number of bytes in the byte sequence. |
Returns
Type | Description |
---|---|
int | The index of the last occurrence of the byte sequence within this string. Returns -1 if no occurrence is found. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringN type. |
LastIndexOf<T>(ref T, byte*, int, int, int)
Returns the index of the last occurrence of a byte sequence within a subrange of this string.
Declaration
public static int LastIndexOf<T>(this ref T fs, byte* bytes, int bytesLen, int startIndex, int distance = 2147483647) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to search. |
byte* | bytes | A byte sequence to search for within this string. |
int | bytesLen | The number of bytes in the byte sequence. |
int | startIndex | The smallest index in this string to consider as the first byte of the byte sequence. |
int | distance | The greatest index in this string to consider as the first byte of the byte sequence. |
Returns
Type | Description |
---|---|
int | The index of the last occurrence of the byte sequence within this string. Returns -1 if no occurrences found. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringN type. |
LastIndexOf<T, T2>(ref T, in T2)
Returns the index of the last occurrence of a substring within this string.
Declaration
public static int LastIndexOf<T, T2>(this ref T fs, in T2 other) where T : struct, INativeList<byte>, IUTF8Bytes where T2 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to search. |
T2 | other | A substring to search for in the this string. |
Returns
Type | Description |
---|---|
int | The index of the last occurrence of the substring within this string. Returns -1 if no occurrence is found. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringN type. |
T2 | A FixedStringN type. |
LastIndexOf<T, T2>(ref T, in T2, int, int)
Returns the index of the last occurrence of a substring within a subrange of this string.
Declaration
public static int LastIndexOf<T, T2>(this ref T fs, in T2 other, int startIndex, int distance = 2147483647) where T : struct, INativeList<byte>, IUTF8Bytes where T2 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to search. |
T2 | other | A substring to search for within this string. |
int | startIndex | The greatest index in this string to consider as an occurrence of the substring. |
int | distance | The smallest index in this string to consider as an occurrence of the substring. |
Returns
Type | Description |
---|---|
int | the index of the last occurrence of the substring within the first string. Returns -1 if no occurrence is found. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringN type. |
T2 | A FixedStringN type. |
Parse<T>(ref T, ref int, ref int)
Parses an int from this string starting at a byte offset.
Declaration
public static ParseError Parse<T>(this ref T fs, ref int offset, ref int output) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | The string from which to parse. |
int | offset | A reference to an index of the byte at which to parse an int. |
int | output | Outputs the parsed int. Ignore if parsing fails. |
Returns
Type | Description |
---|---|
ParseError | ParseError.None if successful. Otherwise returns ParseError.Overflow or ParseError.Syntax. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringNBytes type. |
Remarks
Stops parsing after the last number character. (Unlike parsing methods in other API's, this method does not expect to necessarily parse the entire string.)
The parsed value is bitwise-identical to the result of System.Int32.Parse.
Parse<T>(ref T, ref int, ref float, char)
Parses a float from this string starting at a byte offset.
Declaration
public static ParseError Parse<T>(this ref T fs, ref int offset, ref float output, char decimalSeparator = '.') where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | The string from which to parse. |
int | offset | Index of the byte at which to parse a float. |
float | output | Outputs the parsed float. Ignore if parsing fails. |
char | decimalSeparator | The character used to separate the integer part of the number from the fractional part. Defaults to '.' (period). |
Returns
Type | Description |
---|---|
ParseError | ParseError.None if successful. Otherwise returns ParseError.Overflow, ParseError.Underflow, or ParseError.Syntax. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringNBytes type. |
Remarks
The parsed value is bitwise-identical to the result of System.Single.Parse.
Parse<T>(ref T, ref int, ref uint)
Parses an uint from this string starting at a byte offset.
Declaration
public static ParseError Parse<T>(this ref T fs, ref int offset, ref uint output) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | The string from which to parse. |
int | offset | A reference to an index of the byte at which to parse a uint. |
uint | output | Outputs the parsed uint. Ignore if parsing fails. |
Returns
Type | Description |
---|---|
ParseError | ParseError.None if successful. Otherwise returns ParseError.Overflow or ParseError.Syntax. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringNBytes type. |
Remarks
Stops parsing after the last number character. (Unlike parsing methods in other API's, this method does not expect to necessarily parse the entire string.)
The parsed value is bitwise-identical to the result of System.UInt32.Parse.
Peek<T>(ref T, int)
Returns the Unicode.Rune at an index of this string.
Declaration
public static Unicode.Rune Peek<T>(this ref T fs, int index) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to read. |
int | index | A reference to an index in bytes (not characters). |
Returns
Type | Description |
---|---|
Unicode.Rune | The Unicode.Rune (character) which starts at the byte index. Returns Unicode.BadRune if the byte(s) at the index do not form a valid UTF-8 encoded character. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringN type. |
Read<T>(ref T, ref int)
Returns the Unicode.Rune at an index of this string. Increments the index to the position of the next character.
Declaration
public static Unicode.Rune Read<T>(this ref T fs, ref int index) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to read. |
int | index | A reference to an index in bytes (not characters). Incremented by 1 to 4 depending upon the UTF-8 encoded size of the character read. |
Returns
Type | Description |
---|---|
Unicode.Rune | The character (as a |
Type Parameters
Name | Description |
---|---|
T | A FixedStringN type. |
Write<T>(ref T, ref int, Rune)
Writes a Unicode.Rune at an index of this string. Increments the index to the position of the next character.
Declaration
public static FormatError Write<T>(this ref T fs, ref int index, Unicode.Rune rune) where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to modify. |
int | index | A reference to an index in bytes (not characters). Incremented by 1 to 4 depending upon the UTF-8 encoded size of the character written. |
Unicode.Rune | rune | A rune to write to the string, encoded as UTF-8. |
Returns
Type | Description |
---|---|
FormatError | FormatError.None if successful. Returns FormatError.Overflow if the index is invalid or if there is not enough space to store the encoded rune. |
Type Parameters
Name | Description |
---|---|
T | A FixedStringN type. |