Class FixedStringMethods
Provides extension methods for FixedStringNBytes.
Namespace: Unity.Collections
Syntax
public static class FixedStringMethods
Methods
Append<T>(ref T, Byte*, Int32)
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. |
Int32 | 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, Int32)
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. |
Int32 | 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, Int64)
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. |
Int64 | 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, Single, 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. |
Single | 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 : 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, UInt32)
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. |
UInt32 | 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, UInt64)
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. |
UInt64 | 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, Unicode.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, Unicode.Rune, Int32)
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. |
Int32 | 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.
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.
CompareTo<T>(ref T, Byte*, Int32)
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. |
Int32 | bytesLen | The number of bytes in the byte sequence. |
Returns
Type | Description |
---|---|
Int32 | A number denoting the sort position of this string relative to the byte sequence: 0 denotes that this string and byte sequence have the same sort position. |
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 : 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 |
---|---|
Int32 | A number denoting the relative sort position of the strings: 0 denotes that the strings have the same sort position. |
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 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | fs | A string to get a hash code of. |
Returns
Type | Description |
---|---|
Int32 | 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 : 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 |
---|---|
Boolean | 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 : 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 string type. |
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 : 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.
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 : 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. |
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 : 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 |
---|---|
Int32 | 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, Unicode.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 : struct, 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 |
---|---|
Boolean | 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 : struct, INativeList<byte>, IUTF8Bytes where U : struct, 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 |
---|---|
Boolean | 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*, Int32)
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. |
Int32 | bytesLen | The number of bytes in the byte sequence. |
Returns
Type | Description |
---|---|
Boolean | 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 : 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 |
---|---|
Boolean | 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*, Int32)
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. |
Int32 | bytesLen | The number of bytes in the byte sequence. |
Returns
Type | Description |
---|---|
Int32 | 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*, Int32, Int32, Int32)
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. |
Int32 | bytesLen | The number of bytes in the byte sequence. |
Int32 | startIndex | The first index in this string to consider as the first byte of the byte sequence. |
Int32 | distance | The last index in this string to consider as the first byte of the byte sequence. |
Returns
Type | Description |
---|---|
Int32 | 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, Unicode.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 : struct, 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 |
---|---|
Int32 | 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 : 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 |
---|---|
Int32 | 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, Int32, Int32)
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. |
Int32 | startIndex | The first index in this string to consider as an occurrence of the second string. |
Int32 | distance | The last index in this string to consider as an occurrence of the second string. |
Returns
Type | Description |
---|---|
Int32 | 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*, Int32)
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. |
Int32 | bytesLen | The number of bytes in the byte sequence. |
Returns
Type | Description |
---|---|
Int32 | 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*, Int32, Int32, Int32)
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. |
Int32 | bytesLen | The number of bytes in the byte sequence. |
Int32 | startIndex | The smallest index in this string to consider as the first byte of the byte sequence. |
Int32 | distance | The greatest index in this string to consider as the first byte of the byte sequence. |
Returns
Type | Description |
---|---|
Int32 | 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, Unicode.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 : struct, 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 |
---|---|
Int32 | 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 : 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 |
---|---|
Int32 | 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, Int32, Int32)
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. |
Int32 | startIndex | The greatest index in this string to consider as an occurrence of the substring. |
Int32 | distance | The smallest index in this string to consider as an occurrence of the substring. |
Returns
Type | Description |
---|---|
Int32 | 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 Int32, ref Int32)
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. |
Int32 | offset | A reference to an index of the byte at which to parse an int. |
Int32 | 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 Int32, ref Single, 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. |
Int32 | offset | Index of the byte at which to parse a float. |
Single | 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 Int32, ref UInt32)
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. |
Int32 | offset | A reference to an index of the byte at which to parse a uint. |
UInt32 | 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, Int32)
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. |
Int32 | 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 Int32)
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. |
Int32 | 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, Unicode.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 : struct, 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 |
---|---|
Boolean | 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 : struct, INativeList<byte>, IUTF8Bytes where U : struct, 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 |
---|---|
Boolean | 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, Int32)
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. |
Int32 | startIndex | Start index of substring. |
Returns
Type | Description |
---|---|
NativeText | A NativeText string that begins at |
Substring(ref NativeText, Int32, Int32)
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. |
Int32 | startIndex | Start index of substring. |
Int32 | 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, Int32, Int32, AllocatorManager.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. |
Int32 | startIndex | Start index of substring. |
Int32 | 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, Int32, AllocatorManager.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. |
Int32 | 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, Int32)
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 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | str | A string to get the substring from. |
Int32 | 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, Int32, Int32)
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 : struct, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | str | A string to get the substring from. |
Int32 | startIndex | Start index of substring. |
Int32 | 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, AllocatorManager.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, AllocatorManager.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 : struct, 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, AllocatorManager.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, AllocatorManager.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 : struct, 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, AllocatorManager.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, AllocatorManager.AllocatorHandle, ReadOnlySpan<Unicode.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, AllocatorManager.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, AllocatorManager.AllocatorHandle, ReadOnlySpan<Unicode.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. |
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 : struct, 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<Unicode.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 : struct, 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. |
TrimEnd(ref UnsafeText, AllocatorManager.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, AllocatorManager.AllocatorHandle, ReadOnlySpan<Unicode.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, AllocatorManager.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, AllocatorManager.AllocatorHandle, ReadOnlySpan<Unicode.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 : struct, 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<Unicode.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 : struct, 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, AllocatorManager.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, AllocatorManager.AllocatorHandle, ReadOnlySpan<Unicode.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, AllocatorManager.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, AllocatorManager.AllocatorHandle, ReadOnlySpan<Unicode.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 : struct, 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<Unicode.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 : struct, 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. |
Write<T>(ref T, ref Int32, Unicode.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. |
Int32 | 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. |