private static bool EqualsOrdinalIgnoreCase(char thisChar, char otherChar) { // Do a fast check first before converting to lowercase characters. return (thisChar == otherChar || CaseInsensitiveComparison.ToLower(thisChar) == CaseInsensitiveComparison.ToLower(otherChar)); }
internal int CompareToOrdinalIgnoreCase(StringSlice other) { var thisEnd = this._span.End; var otherEnd = other._span.End; for (int i = this._span.Start, j = other._span.Start; i < thisEnd && j < otherEnd; i++, j++) { var diff = CaseInsensitiveComparison.ToLower(this._underlyingString[i]) - CaseInsensitiveComparison.ToLower(other._underlyingString[j]); if (diff != 0) { return(diff); } } // Choose the one that is shorter if their prefixes match so far. return(this.Length - other.Length); }
public override bool Equals(ReadOnlyMemory <char> x, ReadOnlyMemory <char> y) => CaseInsensitiveComparison.Equals(x.Span, y.Span);
public override int Compare(ReadOnlyMemory <char> x, ReadOnlyMemory <char> y) => CaseInsensitiveComparison.Compare(x.Span, y.Span);