File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -295,6 +295,9 @@ public StringView TrimStart(params char[]? trimChars) =>
295295 /// </returns>
296296 public StringView TrimStart ( ReadOnlySpan < char > trimChars )
297297 {
298+ if ( trimChars . Length == 0 )
299+ return TrimStart ( ) ;
300+
298301 var start = _index ;
299302 var final = _index + _length ;
300303 var value = _value ;
@@ -381,6 +384,9 @@ public StringView TrimEnd(params char[]? trimChars) =>
381384 /// </returns>
382385 public StringView TrimEnd ( ReadOnlySpan < char > trimChars )
383386 {
387+ if ( trimChars . Length == 0 )
388+ return TrimEnd ( ) ;
389+
384390 var start = _index ;
385391 var final = _index + _length - 1 ;
386392 var value = _value ;
@@ -479,6 +485,9 @@ public StringView Trim(params char[]? trimChars) =>
479485 /// </returns>
480486 public StringView Trim ( ReadOnlySpan < char > trimChars )
481487 {
488+ if ( trimChars . Length == 0 )
489+ return Trim ( ) ;
490+
482491 var start = _index ;
483492 var final = _index + _length - 1 ;
484493 var value = _value ;
@@ -487,6 +496,7 @@ public StringView Trim(ReadOnlySpan<char> trimChars)
487496 {
488497 for ( ; start <= final ; start ++ )
489498 {
499+
490500 for ( var i = 0 ; i < trimChars . Length ; i ++ )
491501 if ( value . GetRawStringData ( start ) == trimChars [ i ] )
492502 goto MATCHED ;
You can’t perform that action at this time.
0 commit comments