Method ExtString.Eq(+ 8 overloads)
Overload
Compares this and other string. Returns true
if equal.
public static bool Eq(this string t, string s, bool ignoreCase = false)
Parameters
t (string)
This string. Can be |
s (string)
Other string. Can be |
ignoreCase (bool)
Case-insensitive. |
Returns
Remarks
Uses ordinal comparison (does not depend on current culture/locale).
See Also
Overload(next)
Compares this strings with multiple strings. Returns 1-based index of the matching string, or 0 if none.
public static int Eq(this string t, bool ignoreCase, params ReadOnlySpan<string> strings)
Parameters
t (string)
This string. Can be |
ignoreCase (bool)
Case-insensitive. |
strings (ReadOnlySpan<string>)
Other strings. Strings can be |
Returns
Remarks
Uses ordinal comparison (does not depend on current culture/locale).
Overload(next)
Compares part of this string with other string. Returns true
if equal.
public static bool Eq(this string t, int startIndex, ReadOnlySpan<char> s, bool ignoreCase = false)
Parameters
t (string)
This string. |
startIndex (int)
Offset in this string. If invalid, returns |
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).
See Also
Overload(next)
Compares part of this string with multiple strings. Returns 1-based index of the matching string, or 0 if none.
public static int Eq(this string t, int startIndex, bool ignoreCase = false, params ReadOnlySpan<string> strings)
Parameters
t (string)
This string. |
startIndex (int)
Offset in this string. If invalid, returns |
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)
Compares part of this string with other string. Returns true
if equal.
public static bool Eq(this string t, Range range, ReadOnlySpan<char> s, bool ignoreCase = false)
Parameters
t (string)
This string. |
range (Range)
Range of this string. Can return |
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).
See Also
Overload(next)
Returns true
if the specified character is at the specified position in this string.
public static bool Eq(this string t, int index, char c)
Parameters
t (string)
This string. |
index (int)
Offset in this string. If invalid, returns |
c (char)
Character. |
Returns
Overload(next)
Returns true
if equals to string s, case-sensitive.
public static bool Eq(this ReadOnlySpan<char> t, ReadOnlySpan<char> s)
Parameters
t (ReadOnlySpan<char>)
This span. |
s (ReadOnlySpan<char>)
Other string. Can be |
Returns
Remarks
Uses ordinal comparison (does not depend on current culture/locale).
Overload(next)
Compares part of this span with string s. Returns true
if equal.
public static bool Eq(this ReadOnlySpan<char> t, int startIndex, ReadOnlySpan<char> s, bool ignoreCase = false)
Parameters
t (ReadOnlySpan<char>)
This span. |
startIndex (int)
Offset in this span. If invalid, returns |
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(top)
Returns true
if the specified character is at the specified position in this span.
public static bool Eq(this ReadOnlySpan<char> t, int index, char c)
Parameters
t (ReadOnlySpan<char>)
This span. |
index (int)
Offset in this span. If invalid, returns |
c (char)
Character. |