Ejemplo n.º 1
0
 internal Enumerator(Utf8Span span)
 {
     _currentCharPair    = default;
     _remainingUtf8Bytes = span.Bytes;
 }
Ejemplo n.º 2
0
 internal RuneEnumerable(Utf8Span span)
 {
     _span = span;
 }
Ejemplo n.º 3
0
 public static bool Equals(Utf8Span left, Utf8Span right, StringComparison comparison)
 {
     throw new PlatformNotSupportedException();
 }
Ejemplo n.º 4
0
 internal CharEnumerable(Utf8Span span)
 {
     _span = span;
 }
Ejemplo n.º 5
0
 public bool Equals(Utf8Span other, StringComparison comparison) => throw new PlatformNotSupportedException();
Ejemplo n.º 6
0
 public static bool Equals(Utf8Span left, Utf8Span right) => throw new PlatformNotSupportedException();
Ejemplo n.º 7
0
 /// <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));
 }
Ejemplo n.º 8
0
 public bool Equals(Utf8Span other) => throw new PlatformNotSupportedException();
Ejemplo n.º 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);
Ejemplo n.º 10
0
 /// <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));
 }
Ejemplo n.º 11
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));
        }
Ejemplo n.º 12
0
 /// <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);
 }
Ejemplo n.º 13
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));
 }
Ejemplo n.º 14
0
 /// <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));
 }
Ejemplo n.º 15
0
        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));
        }