File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/WouterVanRanst.Utils/Extensions Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,18 @@ public static string Left(this string str, int length)
1414 return str [ ..Math . Min ( str . Length , length ) ] ;
1515 }
1616
17- public static string RemovePrefix ( this string s , string prefix , StringComparison comparisonType = StringComparison . InvariantCultureIgnoreCase )
17+ /// <summary>
18+ /// Removes the specified prefix from the beginning of the string, if it exists, using StringComparison.InvariantCultureIgnoreCase
19+ /// </summary>
20+ public static string RemovePrefix ( this string s , string prefix ) // NOTE: this overload exists because optional arguments cannot be used in expression trees
21+ {
22+ return RemovePrefix ( s , prefix , StringComparison . InvariantCultureIgnoreCase ) ;
23+ }
24+
25+ /// <summary>
26+ /// Removes the specified prefix from the beginning of the string, if it exists using the specified comparisonType
27+ /// </summary>
28+ public static string RemovePrefix ( this string s , string prefix , StringComparison comparisonType )
1829 {
1930 if ( s . StartsWith ( prefix , comparisonType ) )
2031 return s [ prefix . Length ..] ;
You can’t perform that action at this time.
0 commit comments