Пример #1
0
        /// <summary>
        /// Compares two SpanStrings using an ordinal comparison.
        /// </summary>
        /// <param name="a">The first string to compare.</param>
        /// <param name="b">The second string to compare.</param>
        /// <returns>True if the strings are equal.</returns>
        public static bool EqualsIgnoreCase(SpanString1 a, SpanString2 b)
        {
            if (a.Length != b.Length)
            {
                return false;
            }

            var s1Enum = new Enumerator(a);
            var s2Enum = new SpanString2.Enumerator(b);

            for (int i = 0; i < a.Length; i++)
            {
                int c1 = SpanStringComparer.ToUpperAscii(s1Enum.Next());
                int c2 = SpanStringComparer.ToUpperAscii(s2Enum.Next());
                if (c1 != c2)
                {
                    return false;
                }
            }

            return true;
        }
Пример #2
0
        /// <summary>
        /// Compares two SpanStrings using an ordinal comparison.
        /// </summary>
        /// <param name="a">The first string to compare.</param>
        /// <param name="b">The second string to compare.</param>
        /// <returns>True if the strings are equal.</returns>
        public static bool Equals(SpanString1 a, SpanString2 b)
        {
            if (a.Length != b.Length)
            {
                return false;
            }

            var s1Enum = new Enumerator(a);
            var s2Enum = new SpanString2.Enumerator(b);

            for (int i = 0; i < a.Length; i++)
            {
                int c1 = s1Enum.Next();
                int c2 = s2Enum.Next();
                if (c1 != c2)
                {
                    return false;
                }
            }

            return true;
        }