/// <summary>
        /// Returns a value stating whether the current <see cref="Utf8Span"/> instance contains <paramref name="value"/>.
        /// The specified comparison is used.
        /// </summary>
        public bool Contains(Utf8Span value, StringComparison comparison)
        {
            // TODO_UTF8STRING: Optimize me to avoid allocations.

#if (!NETSTANDARD2_0 && !NETFRAMEWORK)
            return(this.ToString().Contains(value.ToString(), comparison));
#else
            return(this.ToString().IndexOf(value.ToString(), comparison) >= 0);
#endif
        }
Пример #2
0
        public int CompareTo(Utf8Span other)
        {
            // TODO_UTF8STRING: This is ordinal, but String.CompareTo uses CurrentCulture.
            // Is this acceptable?

            // TODO_UTF8STRING: To avoid allocations, use Utf8StringComparer instead of StringComparer once it's submitted.

            return(StringComparer.Ordinal.Compare(this.ToString(), other.ToString()));
        }
Пример #3
0
        /// <summary>
        /// Returns a value stating whether the current <see cref="Utf8Span"/> instance contains <paramref name="value"/>.
        /// The specified comparison is used.
        /// </summary>
        public bool Contains(Utf8Span value, StringComparison comparison)
        {
            // TODO_UTF8STRING: Optimize me to avoid allocations.

            return(this.ToString().Contains(value.ToString(), comparison));
        }
Пример #4
0
        public int CompareTo(Utf8Span other, StringComparison comparison)
        {
            // TODO_UTF8STRING: We can avoid the virtual dispatch by moving the switch into this method.

            // TODO_UTF8STRING: To avoid allocations, use Utf8StringComparer instead of StringComparer once it's submitted.

            return(StringComparer.FromComparison(comparison).Compare(this.ToString(), other.ToString()));
        }