Method ExtString.Starts(+ 3 overloads)
Overload
Compares beginning of this string with other string. Returns true if equal.
public static bool Starts(this string t, ReadOnlySpan<char> s, bool ignoreCase = false)
Parameters
|
t (string)
This string. |
|
s (ReadOnlySpan<char>)
Other string. |
|
ignoreCase (bool)
Case-insensitive. |
Returns
Exceptions
|
ArgumentNullException
s is |
Remarks
Uses ordinal comparison (does not depend on current culture/locale).
Overload(next)
Compares beginning of this string with multiple strings. Returns 1-based index of the matching string, or 0 if none.
public static int Starts(this string t, bool ignoreCase, params ReadOnlySpan<string> strings)
Parameters
|
t (string)
This string. |
|
ignoreCase (bool)
Case-insensitive. |
|
strings (ReadOnlySpan<string>)
Other strings. |
Returns
Exceptions
|
ArgumentNullException
A string in strings is |
Remarks
Uses ordinal comparison (does not depend on current culture/locale).
Overload(next)
Returns true if this string starts with the specified character.
public static bool Starts(this string t, char c)
Parameters
Returns
Overload(top)
Returns true if starts with string s.
public static bool Starts(this ReadOnlySpan<char> t, ReadOnlySpan<char> s, bool ignoreCase = false)
Parameters
|
t (ReadOnlySpan<char>)
This span. |
|
s (ReadOnlySpan<char>)
Other string. |
|
ignoreCase (bool)
Case-insensitive. |
Returns
Remarks
Uses ordinal comparison (does not depend on current culture/locale).