Exemple #1
0
 internal Enumerator(Utf8Span span)
 {
     _currentCharPair    = default;
     _remainingUtf8Bytes = span.Bytes;
 }
Exemple #2
0
 internal RuneEnumerable(Utf8Span span)
 {
     _span = span;
 }
Exemple #3
0
 public static bool Equals(Utf8Span left, Utf8Span right, StringComparison comparison)
 {
     throw new PlatformNotSupportedException();
 }
Exemple #4
0
 internal CharEnumerable(Utf8Span span)
 {
     _span = span;
 }
Exemple #5
0
 public bool Equals(Utf8Span other, StringComparison comparison) => throw new PlatformNotSupportedException();
Exemple #6
0
 public static bool Equals(Utf8Span left, Utf8Span right) => throw new PlatformNotSupportedException();
 /// <summary>
 /// Locates the last occurrence of <paramref name="separator"/> within this <see cref="Utf8Span"/> instance, creating <see cref="Utf8Span"/>
 /// instances which represent the data on either side of the separator. If <paramref name="separator"/> is not found
 /// within this <see cref="Utf8Span"/> instance, returns the tuple "(this, Empty)".
 /// </summary>
 /// <remarks>
 /// The search is performed using the specified <paramref name="comparisonType"/>.
 /// </remarks>
 public SplitOnResult SplitOnLast(Utf8Span separator, StringComparison comparisonType)
 {
     return(TryFindLast(separator, comparisonType, out Range range) ? new SplitOnResult(this, range) : new SplitOnResult(this));
 }
Exemple #8
0
 public bool Equals(Utf8Span other) => throw new PlatformNotSupportedException();
Exemple #9
0
 /// <summary>
 /// Attempts to locate the target <paramref name="value"/> within this <see cref="Utf8Span"/> instance.
 /// If <paramref name="value"/> is found, returns <see langword="true"/> and sets <paramref name="range"/> to
 /// the location where <paramref name="value"/> occurs within this <see cref="Utf8Span"/> instance.
 /// If <paramref name="value"/> is not found, returns <see langword="false"/> and sets <paramref name="range"/>
 /// to <see langword="default"/>.
 /// </summary>
 /// <remarks>
 /// The search is performed using the specified <paramref name="comparisonType"/>.
 /// </remarks>
 public bool TryFind(Utf8Span value, StringComparison comparisonType, out Range range) => TryFind(value, comparisonType, out range, fromBeginning: true);
 /// <summary>
 /// Locates the last occurrence of <paramref name="separator"/> within this <see cref="Utf8Span"/> instance, creating <see cref="Utf8Span"/>
 /// instances which represent the data on either side of the separator. If <paramref name="separator"/> is not found
 /// within this <see cref="Utf8Span"/> instance, returns the tuple "(this, Empty)".
 /// </summary>
 /// <remarks>
 /// An ordinal search is performed.
 /// </remarks>
 public SplitOnResult SplitOnLast(Utf8Span separator)
 {
     return(TryFindLast(separator, out Range range) ? new SplitOnResult(this, range) : new SplitOnResult(this));
 }
        /// <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));
        }
 /// <summary>
 /// Returns a value stating whether the current <see cref="Utf8Span"/> instance contains <paramref name="value"/>.
 /// An ordinal comparison is used.
 /// </summary>
 public bool Contains(Utf8Span value)
 {
     return(this.Bytes.IndexOf(value.Bytes) >= 0);
 }
 /// <summary>
 /// Returns a value stating whether the current <see cref="Utf8Span"/> instance begins with <paramref name="value"/>.
 /// An ordinal comparison is used.
 /// </summary>
 public bool StartsWith(Utf8Span value)
 {
     return(this.Bytes.StartsWith(value.Bytes));
 }
 /// <summary>
 /// Returns a value stating whether the current <see cref="Utf8Span"/> instance ends with <paramref name="value"/>.
 /// An ordinal comparison is used.
 /// </summary>
 public bool EndsWith(Utf8Span value)
 {
     return(this.Bytes.EndsWith(value.Bytes));
 }
        public int CompareTo(Utf8Span other, StringComparison comparison)
        {
            // TODO_UTF8STRING: We can avoid the virtual dispatch by moving the switch into this method.

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