33public static partial class TextExtensions
44{
55 /// <summary>
6- /// Optimized equals for comparing as span vs a string .
6+ /// Compares a sequence of characters with another .
77 /// </summary>
8- /// <param name="source">The source span .</param>
9- /// <param name="other">The string to compare to.</param>
8+ /// <param name="source">The source sequence .</param>
9+ /// <param name="other">The other to compare to.</param>
1010 /// <param name="comparisonType">The string comparison type.</param>
11- /// <returns>True if the are contents equal. </returns>
11+ /// <returns><see langword="true"/> if the are contents equal; otherwise <see langword="false"/> </returns>
1212 public static bool Equals ( this ReadOnlySpan < char > source , StringSegment other , StringComparison comparisonType )
1313 {
1414 if ( ! other . HasValue ) return false ;
@@ -34,13 +34,7 @@ public static bool Equals(this Span<char> source, StringSegment other, StringCom
3434 } ;
3535 }
3636
37- /// <summary>
38- /// Optimized equals for comparing spans.
39- /// </summary>
40- /// <param name="source">The source span.</param>
41- /// <param name="other">The span to compare to.</param>
42- /// <param name="comparisonType">The string comparison type.</param>
43- /// <returns>True if the are contents equal.</returns>
37+ /// <inheritdoc cref="Equals(ReadOnlySpan{char}, StringSegment, StringComparison)"/>
4438 public static bool Equals ( this Span < char > source , ReadOnlySpan < char > other , StringComparison comparisonType )
4539 {
4640 var len = source . Length ;
@@ -52,13 +46,7 @@ public static bool Equals(this Span<char> source, ReadOnlySpan<char> other, Stri
5246 } ;
5347 }
5448
55- /// <summary>
56- /// Optimized equals for comparing as string to a span.
57- /// </summary>
58- /// <param name="source">The source string.</param>
59- /// <param name="other">The span to compare to.</param>
60- /// <param name="comparisonType">The string comparison type.</param>
61- /// <returns>True if the are contents equal.</returns>
49+ /// <inheritdoc cref="Equals(ReadOnlySpan{char}, StringSegment, StringComparison)"/>
6250 public static bool Equals ( this string ? source , ReadOnlySpan < char > other , StringComparison comparisonType )
6351 {
6452 if ( source is null ) return false ;
@@ -71,7 +59,7 @@ public static bool Equals(this string? source, ReadOnlySpan<char> other, StringC
7159 } ;
7260 }
7361
74- /// <inheritdoc cref="Equals(string, ReadOnlySpan{char}, StringComparison)" />
62+ /// <inheritdoc cref="Equals(ReadOnlySpan{char}, StringSegment, StringComparison)"/>
7563 public static bool Equals ( this StringSegment source , ReadOnlySpan < char > other , StringComparison comparisonType )
7664 {
7765 if ( ! source . HasValue ) return false ;
@@ -85,27 +73,27 @@ public static bool Equals(this StringSegment source, ReadOnlySpan<char> other, S
8573 }
8674
8775 /// <remarks>Use <see cref="Equals(ReadOnlySpan{char}, StringSegment, StringComparison)"/> for varying case sensitivity.</remarks>
88- /// <inheritdoc cref="Equals(ReadOnlySpan{char}, StringSegment, StringComparison)" />
76+ /// <inheritdoc cref="Equals(ReadOnlySpan{char}, StringSegment, StringComparison)"/>
8977 public static bool SequenceEqual ( this ReadOnlySpan < char > source , StringSegment other )
9078 => Equals ( source , other , StringComparison . Ordinal ) ;
9179
9280 /// <remarks>Use <see cref="Equals(Span{char}, StringSegment, StringComparison)"/> for varying case sensitivity.</remarks>
93- /// <inheritdoc cref="Equals(Span {char}, StringSegment, StringComparison)" />
81+ /// <inheritdoc cref="Equals(ReadOnlySpan {char}, StringSegment, StringComparison)"/>
9482 public static bool SequenceEqual ( this Span < char > source , StringSegment other )
9583 => Equals ( source , other , StringComparison . Ordinal ) ;
9684
9785 /// <remarks>Use <see cref="Equals(Span{char}, ReadOnlySpan{char}, StringComparison)"/> for varying case sensitivity.</remarks>
98- /// <inheritdoc cref="Equals(Span {char}, ReadOnlySpan{char} , StringComparison)" />
86+ /// <inheritdoc cref="Equals(ReadOnlySpan {char}, StringSegment , StringComparison)"/>
9987 public static bool SequenceEqual ( this Span < char > source , Span < char > other )
10088 => Equals ( source , other , StringComparison . Ordinal ) ;
10189
10290 /// <remarks>Use <see cref="Equals(string?, ReadOnlySpan{char}, StringComparison)"/> for varying case sensitivity.</remarks>
103- /// <inheritdoc cref="Equals(string, ReadOnlySpan{char}, StringComparison)" />
91+ /// <inheritdoc cref="Equals(ReadOnlySpan{char}, StringSegment, StringComparison)"/>
10492 public static bool SequenceEqual ( this string ? source , ReadOnlySpan < char > other )
10593 => Equals ( source , other , StringComparison . Ordinal ) ;
10694
10795 /// <remarks>Use <see cref="Equals(StringSegment, ReadOnlySpan{char}, StringComparison)"/> for varying case sensitivity.</remarks>
108- /// <inheritdoc cref="Equals(StringSegment, ReadOnlySpan{char}, StringComparison)" />
96+ /// <inheritdoc cref="Equals(ReadOnlySpan{char}, StringSegment, StringComparison)"/>
10997 public static bool SequenceEqual ( this StringSegment source , ReadOnlySpan < char > other )
11098 => Equals ( source , other , StringComparison . Ordinal ) ;
11199
@@ -183,13 +171,14 @@ public static bool TrimmedEquals(this string? source, ReadOnlySpan<char> other,
183171 && source . AsSpan ( ) . Trim ( trimChars ) . Equals ( other , comparisonType ) ;
184172
185173 /// <summary>
186- /// Optimized equals for comparing a trimmed string with another string .
174+ /// Compares a sequence of characters with leading and trailing whitespace removed with another.
187175 /// </summary>
188- /// <param name="source">The source string to virtually trim.</param>
189- /// <param name="other">The string to compare to.</param>
176+ /// <remarks>Only "trims" the source and not the other used to compare agains.</remarks>
177+ /// <param name="source">The source sequence.</param>
178+ /// <param name="other">The other to compare to.</param>
190179 /// <param name="trimChars">The characters to trim.</param>
191180 /// <param name="comparisonType">The string comparison type.</param>
192- /// <returns>True if the are contents equal.</returns >
181+ /// <inheritdoc cref="Equals(ReadOnlySpan{char}, StringSegment, StringComparison)"/ >
193182 public static bool TrimmedEquals ( this StringSegment source , StringSegment other , ReadOnlySpan < char > trimChars , StringComparison comparisonType = StringComparison . Ordinal )
194183 => source . HasValue
195184 ? other . HasValue
0 commit comments