Method IndexOf
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>(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, 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. |