Class FixedStringMethods
Provides extension methods for FixedStringNBytes.
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 FormatError 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 : unmanaged, INativeList<byte>, IUTF8Bytes where U : unmanaged, INativeList<byte>, IUTF8Bytes where T0 : unmanaged, INativeList<byte>, IUTF8Bytes where T1 : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, INativeList<byte>, IUTF8Bytes where T3 : unmanaged, INativeList<byte>, IUTF8Bytes where T4 : unmanaged, INativeList<byte>, IUTF8Bytes where T5 : unmanaged, INativeList<byte>, IUTF8Bytes where T6 : unmanaged, INativeList<byte>, IUTF8Bytes where T7 : unmanaged, 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. |
Returns
Type | Description |
---|---|
FormatError | None if successful. Otherwise returns the appropriate FormatError. |
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 FormatError 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 : unmanaged, INativeList<byte>, IUTF8Bytes where U : unmanaged, INativeList<byte>, IUTF8Bytes where T0 : unmanaged, INativeList<byte>, IUTF8Bytes where T1 : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, INativeList<byte>, IUTF8Bytes where T3 : unmanaged, INativeList<byte>, IUTF8Bytes where T4 : unmanaged, INativeList<byte>, IUTF8Bytes where T5 : unmanaged, INativeList<byte>, IUTF8Bytes where T6 : unmanaged, INativeList<byte>, IUTF8Bytes where T7 : unmanaged, INativeList<byte>, IUTF8Bytes where T8 : unmanaged, 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. |
Returns
Type | Description |
---|---|
FormatError | None if successful. Otherwise returns the appropriate FormatError. |
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 FormatError 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 : unmanaged, INativeList<byte>, IUTF8Bytes where U : unmanaged, INativeList<byte>, IUTF8Bytes where T0 : unmanaged, INativeList<byte>, IUTF8Bytes where T1 : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, INativeList<byte>, IUTF8Bytes where T3 : unmanaged, INativeList<byte>, IUTF8Bytes where T4 : unmanaged, INativeList<byte>, IUTF8Bytes where T5 : unmanaged, INativeList<byte>, IUTF8Bytes where T6 : unmanaged, INativeList<byte>, IUTF8Bytes where T7 : unmanaged, INativeList<byte>, IUTF8Bytes where T8 : unmanaged, INativeList<byte>, IUTF8Bytes where T9 : unmanaged, 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. |
Returns
Type | Description |
---|---|
FormatError | None if successful. Otherwise returns the appropriate FormatError. |
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 FormatError AppendFormat<T, U, T0>(this ref T dest, in U format, in T0 arg0) where T : unmanaged, INativeList<byte>, IUTF8Bytes where U : unmanaged, INativeList<byte>, IUTF8Bytes where T0 : unmanaged, 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. |
Returns
Type | Description |
---|---|
FormatError | None if successful. Otherwise returns the appropriate FormatError. |
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 FormatError AppendFormat<T, U, T0, T1>(this ref T dest, in U format, in T0 arg0, in T1 arg1) where T : unmanaged, INativeList<byte>, IUTF8Bytes where U : unmanaged, INativeList<byte>, IUTF8Bytes where T0 : unmanaged, INativeList<byte>, IUTF8Bytes where T1 : unmanaged, 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. |
Returns
Type | Description |
---|---|
FormatError | None if successful. Otherwise returns the appropriate FormatError. |
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 FormatError AppendFormat<T, U, T0, T1, T2>(this ref T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2) where T : unmanaged, INativeList<byte>, IUTF8Bytes where U : unmanaged, INativeList<byte>, IUTF8Bytes where T0 : unmanaged, INativeList<byte>, IUTF8Bytes where T1 : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, 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. |
Returns
Type | Description |
---|---|
FormatError | None if successful. Otherwise returns the appropriate FormatError. |
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 FormatError 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 : unmanaged, INativeList<byte>, IUTF8Bytes where U : unmanaged, INativeList<byte>, IUTF8Bytes where T0 : unmanaged, INativeList<byte>, IUTF8Bytes where T1 : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, INativeList<byte>, IUTF8Bytes where T3 : unmanaged, 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. |
Returns
Type | Description |
---|---|
FormatError | None if successful. Otherwise returns the appropriate FormatError. |
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 FormatError 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 : unmanaged, INativeList<byte>, IUTF8Bytes where U : unmanaged, INativeList<byte>, IUTF8Bytes where T0 : unmanaged, INativeList<byte>, IUTF8Bytes where T1 : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, INativeList<byte>, IUTF8Bytes where T3 : unmanaged, INativeList<byte>, IUTF8Bytes where T4 : unmanaged, 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. |
Returns
Type | Description |
---|---|
FormatError | None if successful. Otherwise returns the appropriate FormatError. |
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 FormatError 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 : unmanaged, INativeList<byte>, IUTF8Bytes where U : unmanaged, INativeList<byte>, IUTF8Bytes where T0 : unmanaged, INativeList<byte>, IUTF8Bytes where T1 : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, INativeList<byte>, IUTF8Bytes where T3 : unmanaged, INativeList<byte>, IUTF8Bytes where T4 : unmanaged, INativeList<byte>, IUTF8Bytes where T5 : unmanaged, 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. |
Returns
Type | Description |
---|---|
FormatError | None if successful. Otherwise returns the appropriate FormatError. |
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 FormatError 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 : unmanaged, INativeList<byte>, IUTF8Bytes where U : unmanaged, INativeList<byte>, IUTF8Bytes where T0 : unmanaged, INativeList<byte>, IUTF8Bytes where T1 : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, INativeList<byte>, IUTF8Bytes where T3 : unmanaged, INativeList<byte>, IUTF8Bytes where T4 : unmanaged, INativeList<byte>, IUTF8Bytes where T5 : unmanaged, INativeList<byte>, IUTF8Bytes where T6 : unmanaged, 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. |
Returns
Type | Description |
---|---|
FormatError | None if successful. Otherwise returns the appropriate FormatError. |
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 : unmanaged, 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 : unmanaged, 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 : unmanaged, 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 : unmanaged, 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 : unmanaged, 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 : unmanaged, 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
[ExcludeFromBurstCompatTesting("Takes managed string")]
public static FormatError Append<T>(this ref T fs, string s) where T : unmanaged, 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 : unmanaged, 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 : unmanaged, 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 : unmanaged, 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 : unmanaged, 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 : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, 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 : unmanaged, 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 string 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 : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, 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 string type. |
T2 | A string type. |
ComputeHashCode<T>(ref T)
Returns a hash code of this string.
Declaration
public static int ComputeHashCode<T>(this ref T fs) where T : unmanaged, 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 string 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 : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, 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 string type. |
T2 | A string type. |
ConvertToString<T>(ref T)
Returns a copy of this string as a managed string.
Declaration
[ExcludeFromBurstCompatTesting("Returns managed string")]
public static string ConvertToString<T>(this ref T fs) where T : unmanaged, 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 string type. |
CopyFromTruncated<T>(ref T, string)
Copies another string to this string. If the string exceeds the capacity it will be truncated. Replaces any existing content of the FixedString.
Declaration
[ExcludeFromBurstCompatTesting("Takes managed string")]
public static CopyError CopyFromTruncated<T>(this ref T fs, string s) where T : unmanaged, 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. |
CopyFromTruncated<T, T2>(ref T, in T2)
Copies another string to this string. If the string exceeds the capacity it will be truncated.
Declaration
public static CopyError CopyFromTruncated<T, T2>(this ref T fs, in T2 input) where T : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, 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.
CopyFrom<T>(ref T, string)
Copies another string to this string (making the two strings equal). Replaces any existing content of the FixedString.
Declaration
[ExcludeFromBurstCompatTesting("Takes managed string")]
public static CopyError CopyFrom<T>(this ref T fs, string s) where T : unmanaged, 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 : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, 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 : unmanaged, 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 string 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 string.
EndsWith<T>(ref T, Rune)
Returns true if a given character occurs at the end of this string.
Declaration
public static bool EndsWith<T>(this ref T fs, Unicode.Rune rune) where T : unmanaged, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to search. |
Unicode.Rune | rune | A character to search for within this string. |
Returns
Type | Description |
---|---|
bool | True if the character occurs at the end of this string. |
Type Parameters
Name | Description |
---|---|
T | A string type. |
EndsWith<T, U>(ref T, in U)
Returns true if a given substring occurs at the end of this string.
Declaration
public static bool EndsWith<T, U>(this ref T fs, in U other) where T : unmanaged, INativeList<byte>, IUTF8Bytes where U : unmanaged, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to search. |
U | other | A substring to search for within this string. |
Returns
Type | Description |
---|---|
bool | True if the substring occurs at the end of this string. |
Type Parameters
Name | Description |
---|---|
T | A string type. |
U | A string type. |
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 : unmanaged, 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 string 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 : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, 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 string type. |
T2 | A string 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 : unmanaged, 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 string 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 : unmanaged, 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 string type. |
IndexOf<T>(ref T, Rune)
Returns the index of the first occurrence of a single Unicode rune in this string.
Declaration
public static int IndexOf<T>(this ref T fs, Unicode.Rune rune) where T : unmanaged, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to search. |
Unicode.Rune | rune | A single UTF-8 Unicode Rune to search for within this string. |
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 string 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 : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, 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 string type. |
T2 | A string 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 : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, 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 string type. |
T2 | A string 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 : unmanaged, 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 string 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 : unmanaged, 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 string type. |
LastIndexOf<T>(ref T, Rune)
Returns the index of the last occurrence of a single Unicode rune within this string.
Declaration
public static int LastIndexOf<T>(this ref T fs, Unicode.Rune rune) where T : unmanaged, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to search. |
Unicode.Rune | rune | A single Unicode.Rune to search for within this string. |
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 string 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 : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, 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 string type. |
T2 | A string 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 : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, 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 string type. |
T2 | A string 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 : unmanaged, 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 : unmanaged, 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 : unmanaged, 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 : unmanaged, 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 string 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 : unmanaged, 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 string type. |
StartsWith<T>(ref T, Rune)
Returns true if a given character occurs at the beginning of this string.
Declaration
public static bool StartsWith<T>(this ref T fs, Unicode.Rune rune) where T : unmanaged, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to search. |
Unicode.Rune | rune | A character to search for within this string. |
Returns
Type | Description |
---|---|
bool | True if the character occurs at the beginning of this string. |
Type Parameters
Name | Description |
---|---|
T | A string type. |
StartsWith<T, U>(ref T, in U)
Returns true if a given substring occurs at the beginning of this string.
Declaration
public static bool StartsWith<T, U>(this ref T fs, in U other) where T : unmanaged, INativeList<byte>, IUTF8Bytes where U : unmanaged, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to search. |
U | other | A substring to search for within this string. |
Returns
Type | Description |
---|---|
bool | True if the substring occurs at the beginning of this string. |
Type Parameters
Name | Description |
---|---|
T | A string type. |
U | A string type. |
Substring(ref NativeText, int)
Retrieves a substring of this string. The substring starts from a specific character index and continues to the end of the string. The new substring has the same allocator as the string.
Declaration
public static NativeText Substring(this ref NativeText str, int startIndex)
Parameters
Type | Name | Description |
---|---|---|
NativeText | str | A NativeText to get the substring from. |
int | startIndex | Start index of substring. |
Returns
Type | Description |
---|---|
NativeText | A NativeText string that begins at |
Substring(ref NativeText, int, int)
Retrieves a substring of this string. The substring starts from a specific character index, and has a specified length. The new substring has the same allocator as the string.
Declaration
public static NativeText Substring(this ref NativeText str, int startIndex, int length)
Parameters
Type | Name | Description |
---|---|---|
NativeText | str | A NativeText string to get the substring from. |
int | startIndex | Start index of substring. |
int | length | Length of substring. |
Returns
Type | Description |
---|---|
NativeText | A NativeText string that has length equivalent to |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if startIndex or length parameter is negative, or if startIndex is larger than string length. |
Substring(ref NativeText, int, int, AllocatorHandle)
Retrieves a substring from this string. The substring starts from a specific character index, and has a specified length. Allocates memory to the new substring with the allocator specified.
Declaration
public static NativeText Substring(this ref NativeText str, int startIndex, int length, AllocatorManager.AllocatorHandle allocator)
Parameters
Type | Name | Description |
---|---|---|
NativeText | str | A NativeText string to get the substring from. |
int | startIndex | Start index of substring. |
int | length | Length of substring. |
AllocatorManager.AllocatorHandle | allocator | The AllocatorManager.AllocatorHandle allocator type to use. |
Returns
Type | Description |
---|---|
NativeText | A |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if startIndex or length parameter is negative, or if startIndex is larger than string length. |
Substring(ref NativeText, int, AllocatorHandle)
Retrieves a substring of this string. The substring starts from a specific character index and continues to the end of the string. Allocates memory to the new substring with the allocator specified.
Declaration
public static NativeText Substring(this ref NativeText str, int startIndex, AllocatorManager.AllocatorHandle allocator)
Parameters
Type | Name | Description |
---|---|---|
NativeText | str | A NativeText string to get the substring from. |
int | startIndex | Start index of substring. |
AllocatorManager.AllocatorHandle | allocator | The AllocatorManager.AllocatorHandle allocator type to use. |
Returns
Type | Description |
---|---|
NativeText | A NativeText string that begins at |
Substring<T>(ref T, int)
Retrieves a substring of this string. The substring starts from a specific character index and continues to the end of the string.
Declaration
public static T Substring<T>(this ref T str, int startIndex) where T : unmanaged, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | str | A string to get the substring from. |
int | startIndex | Start index of substring. |
Returns
Type | Description |
---|---|
T | A new string that begins at |
Type Parameters
Name | Description |
---|---|
T | A string type. |
Substring<T>(ref T, int, int)
Retrieves a substring of this string. The substring starts from a specific character index, and has a specified length.
Declaration
public static T Substring<T>(this ref T str, int startIndex, int length) where T : unmanaged, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | str | A string to get the substring from. |
int | startIndex | Start index of substring. |
int | length | Length of substring. |
Returns
Type | Description |
---|---|
T | A new string with length equivalent to |
Type Parameters
Name | Description |
---|---|
T | A string type. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if startIndex or length parameter is negative, or if startIndex is larger than the string length. |
ToLowerAscii(ref UnsafeText, AllocatorHandle)
Converts string to lowercase only ASCII characters.
Declaration
public static UnsafeText ToLowerAscii(this ref UnsafeText fs, AllocatorManager.AllocatorHandle allocator)
Parameters
Type | Name | Description |
---|---|---|
UnsafeText | fs | A UnsafeText string to perform operation. |
AllocatorManager.AllocatorHandle | allocator | The AllocatorManager.AllocatorHandle allocator type to use. |
Returns
Type | Description |
---|---|
UnsafeText | Returns a copy of this string converted to lowercase ASCII. |
ToLowerAscii(ref NativeText, AllocatorHandle)
Converts string to lowercase only ASCII characters.
Declaration
public static NativeText ToLowerAscii(this ref NativeText fs, AllocatorManager.AllocatorHandle allocator)
Parameters
Type | Name | Description |
---|---|---|
NativeText | fs | A NativeText string to perform operation. |
AllocatorManager.AllocatorHandle | allocator | The AllocatorManager.AllocatorHandle allocator type to use. |
Returns
Type | Description |
---|---|
NativeText | Returns a copy of this string converted to lowercase ASCII. |
ToLowerAscii<T>(ref T)
Converts string to lowercase only ASCII characters.
Declaration
public static T ToLowerAscii<T>(this ref T fs) where T : unmanaged, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to perform operation. |
Returns
Type | Description |
---|---|
T | Returns a copy of this string converted to lowercase ASCII. |
Type Parameters
Name | Description |
---|---|
T | A string type. |
ToUpperAscii(ref UnsafeText, AllocatorHandle)
Converts string to uppercase only ASCII characters.
Declaration
public static UnsafeText ToUpperAscii(this ref UnsafeText fs, AllocatorManager.AllocatorHandle allocator)
Parameters
Type | Name | Description |
---|---|---|
UnsafeText | fs | A UnsafeText string to perform operation. |
AllocatorManager.AllocatorHandle | allocator | The AllocatorManager.AllocatorHandle allocator type to use. |
Returns
Type | Description |
---|---|
UnsafeText | Returns a copy of this string converted to uppercase ASCII. |
ToUpperAscii(ref NativeText, AllocatorHandle)
Converts string to uppercase only ASCII characters.
Declaration
public static NativeText ToUpperAscii(this ref NativeText fs, AllocatorManager.AllocatorHandle allocator)
Parameters
Type | Name | Description |
---|---|---|
NativeText | fs | A NativeText string to perform operation. |
AllocatorManager.AllocatorHandle | allocator | The AllocatorManager.AllocatorHandle allocator type to use. |
Returns
Type | Description |
---|---|
NativeText | Returns a copy of this string converted to uppercase ASCII. |
ToUpperAscii<T>(ref T)
Converts string to uppercase only ASCII characters.
Declaration
public static T ToUpperAscii<T>(this ref T fs) where T : unmanaged, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to perform operation. |
Returns
Type | Description |
---|---|
T | Returns a copy of this string converted to uppercase ASCII. |
Type Parameters
Name | Description |
---|---|
T | A string type. |
Trim(ref UnsafeText, AllocatorHandle)
Removes whitespace characters from the begining and the end of the string.
Declaration
public static UnsafeText Trim(this ref UnsafeText fs, AllocatorManager.AllocatorHandle allocator)
Parameters
Type | Name | Description |
---|---|---|
UnsafeText | fs | A UnsafeText string to perform operation. |
AllocatorManager.AllocatorHandle | allocator | The AllocatorManager.AllocatorHandle allocator type to use. |
Returns
Type | Description |
---|---|
UnsafeText | Returns instance of this string with whitespace characters removed from the begining and the end of the string. |
Trim(ref UnsafeText, AllocatorHandle, ReadOnlySpan<Rune>)
Removes specific characters from the begining and the end of the string.
Declaration
public static UnsafeText Trim(this ref UnsafeText fs, AllocatorManager.AllocatorHandle allocator, ReadOnlySpan<Unicode.Rune> trimRunes)
Parameters
Type | Name | Description |
---|---|---|
UnsafeText | fs | A UnsafeText string to perform operation. |
AllocatorManager.AllocatorHandle | allocator | The AllocatorManager.AllocatorHandle allocator type to use. |
ReadOnlySpan<Unicode.Rune> | trimRunes | Runes that should be trimmed. |
Returns
Type | Description |
---|---|
UnsafeText | Returns instance of this string with specific characters removed from the begining and the end of the string. |
Trim(ref NativeText, AllocatorHandle)
Removes whitespace characters from the begining and the end of the string.
Declaration
public static NativeText Trim(this ref NativeText fs, AllocatorManager.AllocatorHandle allocator)
Parameters
Type | Name | Description |
---|---|---|
NativeText | fs | A NativeText string to perform operation. |
AllocatorManager.AllocatorHandle | allocator | The AllocatorManager.AllocatorHandle allocator type to use. |
Returns
Type | Description |
---|---|
NativeText | Returns instance of this string with whitespace characters removed from the begining and the end of the string. |
Trim(ref NativeText, AllocatorHandle, ReadOnlySpan<Rune>)
Removes specific characters from the begining and the end of the string.
Declaration
public static NativeText Trim(this ref NativeText fs, AllocatorManager.AllocatorHandle allocator, ReadOnlySpan<Unicode.Rune> trimRunes)
Parameters
Type | Name | Description |
---|---|---|
NativeText | fs | A NativeText string to perform operation. |
AllocatorManager.AllocatorHandle | allocator | The AllocatorManager.AllocatorHandle allocator type to use. |
ReadOnlySpan<Unicode.Rune> | trimRunes | Runes that should be trimmed. |
Returns
Type | Description |
---|---|
NativeText | Returns instance of this string with specific characters removed from the begining and the end of the string. |
TrimEnd(ref UnsafeText, AllocatorHandle)
Removes whitespace characters from the end of the string.
Declaration
public static UnsafeText TrimEnd(this ref UnsafeText fs, AllocatorManager.AllocatorHandle allocator)
Parameters
Type | Name | Description |
---|---|---|
UnsafeText | fs | A UnsafeText string to perform operation. |
AllocatorManager.AllocatorHandle | allocator | The AllocatorManager.AllocatorHandle allocator type to use. |
Returns
Type | Description |
---|---|
UnsafeText | Returns instance of this string with whitespace characters removed from the end of the string. |
TrimEnd(ref UnsafeText, AllocatorHandle, ReadOnlySpan<Rune>)
Removes specific characters from the end of the string.
Declaration
public static UnsafeText TrimEnd(this ref UnsafeText fs, AllocatorManager.AllocatorHandle allocator, ReadOnlySpan<Unicode.Rune> trimRunes)
Parameters
Type | Name | Description |
---|---|---|
UnsafeText | fs | A UnsafeText string to perform operation. |
AllocatorManager.AllocatorHandle | allocator | The AllocatorManager.AllocatorHandle allocator type to use. |
ReadOnlySpan<Unicode.Rune> | trimRunes | Runes that should be trimmed. |
Returns
Type | Description |
---|---|
UnsafeText | Returns instance of this string with specific characters removed from the end of the string. |
TrimEnd(ref NativeText, AllocatorHandle)
Removes whitespace characters from the end of the string.
Declaration
public static NativeText TrimEnd(this ref NativeText fs, AllocatorManager.AllocatorHandle allocator)
Parameters
Type | Name | Description |
---|---|---|
NativeText | fs | A NativeText string to perform operation. |
AllocatorManager.AllocatorHandle | allocator | The AllocatorManager.AllocatorHandle allocator type to use. |
Returns
Type | Description |
---|---|
NativeText | Returns instance of this string with whitespace characters removed from the end of the string. |
TrimEnd(ref NativeText, AllocatorHandle, ReadOnlySpan<Rune>)
Removes specific characters from the end of the string.
Declaration
public static NativeText TrimEnd(this ref NativeText fs, AllocatorManager.AllocatorHandle allocator, ReadOnlySpan<Unicode.Rune> trimRunes)
Parameters
Type | Name | Description |
---|---|---|
NativeText | fs | A NativeText string to perform operation. |
AllocatorManager.AllocatorHandle | allocator | The AllocatorManager.AllocatorHandle allocator type to use. |
ReadOnlySpan<Unicode.Rune> | trimRunes | Runes that should be trimmed. |
Returns
Type | Description |
---|---|
NativeText | Returns instance of this string with specific characters removed from the end of the string. |
TrimEnd<T>(ref T)
Removes whitespace characters from the end of the string.
Declaration
public static T TrimEnd<T>(this ref T fs) where T : unmanaged, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to perform operation. |
Returns
Type | Description |
---|---|
T | Returns instance of this string with whitespace characters removed from the end of the string. |
Type Parameters
Name | Description |
---|---|
T | A string type. |
TrimEnd<T>(ref T, ReadOnlySpan<Rune>)
Removes specific characters from the end of the string.
Declaration
public static T TrimEnd<T>(this ref T fs, ReadOnlySpan<Unicode.Rune> trimRunes) where T : unmanaged, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to perform operation. |
ReadOnlySpan<Unicode.Rune> | trimRunes | Runes that should be trimmed. |
Returns
Type | Description |
---|---|
T | Returns instance of this string with specific characters removed from the end of the string. |
Type Parameters
Name | Description |
---|---|
T | A string type. |
TrimStart(ref UnsafeText, AllocatorHandle)
Removes whitespace characters from begining of the string.
Declaration
public static UnsafeText TrimStart(this ref UnsafeText fs, AllocatorManager.AllocatorHandle allocator)
Parameters
Type | Name | Description |
---|---|---|
UnsafeText | fs | A UnsafeText string to perform operation. |
AllocatorManager.AllocatorHandle | allocator | The AllocatorManager.AllocatorHandle allocator type to use. |
Returns
Type | Description |
---|---|
UnsafeText | Returns instance of this string with whitespace characters removed from the start of the string. |
TrimStart(ref UnsafeText, AllocatorHandle, ReadOnlySpan<Rune>)
Removes specific characters characters from begining of the string.
Declaration
public static UnsafeText TrimStart(this ref UnsafeText fs, AllocatorManager.AllocatorHandle allocator, ReadOnlySpan<Unicode.Rune> trimRunes)
Parameters
Type | Name | Description |
---|---|---|
UnsafeText | fs | A UnsafeText string to perform operation. |
AllocatorManager.AllocatorHandle | allocator | The AllocatorManager.AllocatorHandle allocator type to use. |
ReadOnlySpan<Unicode.Rune> | trimRunes | Runes that should be trimmed. |
Returns
Type | Description |
---|---|
UnsafeText | Returns instance of this string with specific characters removed from the start of the string. |
TrimStart(ref NativeText, AllocatorHandle)
Removes whitespace characters from begining of the string.
Declaration
public static NativeText TrimStart(this ref NativeText fs, AllocatorManager.AllocatorHandle allocator)
Parameters
Type | Name | Description |
---|---|---|
NativeText | fs | A NativeText string to perform operation. |
AllocatorManager.AllocatorHandle | allocator | The AllocatorManager.AllocatorHandle allocator type to use. |
Returns
Type | Description |
---|---|
NativeText | Returns instance of this string with whitespace characters removed from the start of the string. |
TrimStart(ref NativeText, AllocatorHandle, ReadOnlySpan<Rune>)
Removes specific characters from begining of the string.
Declaration
public static NativeText TrimStart(this ref NativeText fs, AllocatorManager.AllocatorHandle allocator, ReadOnlySpan<Unicode.Rune> trimRunes)
Parameters
Type | Name | Description |
---|---|---|
NativeText | fs | A NativeText string to perform operation. |
AllocatorManager.AllocatorHandle | allocator | The AllocatorManager.AllocatorHandle allocator type to use. |
ReadOnlySpan<Unicode.Rune> | trimRunes | Runes that should be trimmed. |
Returns
Type | Description |
---|---|
NativeText | Returns instance of this string with specific characters removed from the start of the string. |
TrimStart<T>(ref T)
Removes whitespace characters from begining of the string.
Declaration
public static T TrimStart<T>(this ref T fs) where T : unmanaged, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to perform operation. |
Returns
Type | Description |
---|---|
T | Returns instance of this string with whitespace characters removed from the start of the string. |
Type Parameters
Name | Description |
---|---|
T | A string type. |
TrimStart<T>(ref T, ReadOnlySpan<Rune>)
Removes specific characters from begining of the string.
Declaration
public static T TrimStart<T>(this ref T fs, ReadOnlySpan<Unicode.Rune> trimRunes) where T : unmanaged, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to perform operation. |
ReadOnlySpan<Unicode.Rune> | trimRunes | Runes that should be trimmed. |
Returns
Type | Description |
---|---|
T | Returns instance of this string with specific characters removed from the start of the string. |
Type Parameters
Name | Description |
---|---|
T | A string type. |
Trim<T>(ref T)
Removes whitespace characters from the begining and the end of the string.
Declaration
public static T Trim<T>(this ref T fs) where T : unmanaged, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to perform operation. |
Returns
Type | Description |
---|---|
T | Returns instance of this string with whitespace characters removed from the begining and the end of the string. |
Type Parameters
Name | Description |
---|---|
T | A string type. |
Trim<T>(ref T, ReadOnlySpan<Rune>)
Removes specific characters from the begining and the end of the string.
Declaration
public static T Trim<T>(this ref T fs, ReadOnlySpan<Unicode.Rune> trimRunes) where T : unmanaged, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to perform operation. |
ReadOnlySpan<Unicode.Rune> | trimRunes | Runes that should be trimmed. |
Returns
Type | Description |
---|---|
T | Returns instance of this string with specific characters removed from the begining and the end of the string. |
Type Parameters
Name | Description |
---|---|
T | A string 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 : unmanaged, 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 string type. |