public static int Compare(StringSection a, StringSection b, bool ignoreCase, System.Globalization.CultureInfo culture, System.Globalization.CompareOptions options) { var result = string.Compare(a.baseString, a.start, b.baseString, b.start, Math.Min(a.length, b.length), culture, options); // If the two strings are different lengths, they are not equal. The longer string will be considered greater. if (result == 0 && a.length != b.length) { return(a.length > b.length ? 1 : -1); } return(result); }
public static int Compare(StringSection a, StringSection b, StringComparison comparisonType) { var result = string.Compare(a.baseString, a.start, b.baseString, b.start, Math.Min(a.length, b.length), comparisonType); // If the two strings are different lengths, they are not equal. The longer string will be considered greater. if (result == 0 && a.length != b.length) { return(a.length > b.length ? 1 : -1); } return(result); }
public void Split(int index, out StringSection left, out StringSection right) { left = new StringSection(this, 0, index); right = new StringSection(this, index, length - index); }
public StringSection(StringSection str, int start, int len) { this.baseString = str.baseString; this.length = len; this.start = start + str.start; }
public bool Equals(StringSection s) { return(Compare(this, s, false) == 0); }