@@ -38,19 +38,19 @@ public static string BaseConvert(this string source, int from, int to)
3838 var chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
3939 var len = source . Length ;
4040 if ( len == 0 )
41- throw new Exception ( Format ( "Parameter: '{0 }' is not valid integer (in base {1 })." , source , from ) ) ;
41+ throw new Exception ( $ "Parameter: '{ source } ' is not valid integer (in base { @from } ).") ;
4242 var minus = source [ 0 ] == '-' ? "-" : "" ;
4343 var src = minus == "" ? source : source . Substring ( 1 ) ;
4444 len = src . Length ;
4545 if ( len == 0 )
46- throw new Exception ( Format ( "Parameter: '{0 }' is not valid integer (in base {1 })." , source , from ) ) ;
46+ throw new Exception ( $ "Parameter: '{ source } ' is not valid integer (in base { @from } ).") ;
4747
4848 var d = 0 ;
4949 for ( int i = 0 ; i < len ; i ++ ) // Convert to decimal
5050 {
5151 int c = chars . IndexOf ( src [ i ] ) ;
5252 if ( c >= from )
53- throw new Exception ( Format ( "Parameter: '{0 }' is not valid integer (in base {1 })." , source , from ) ) ;
53+ throw new Exception ( $ "Parameter: '{ source } ' is not valid integer (in base { @from } ).") ;
5454 d = d * from + c ;
5555 }
5656 if ( to == 10 || d == 0 )
@@ -227,7 +227,7 @@ public static string ToRot13(this string value)
227227 public static string WithTrailingSlash ( this string path )
228228 {
229229 if ( String . IsNullOrEmpty ( path ) )
230- throw new ArgumentNullException ( " path" ) ;
230+ throw new ArgumentNullException ( nameof ( path ) ) ;
231231
232232 if ( path [ path . Length - 1 ] != '/' )
233233 {
@@ -650,22 +650,22 @@ public static string ExtractContents(this string fromText, string startAfter, st
650650 public static string ExtractContents ( this string fromText , string uniqueMarker , string startAfter , string endAt )
651651 {
652652 if ( String . IsNullOrEmpty ( uniqueMarker ) )
653- throw new ArgumentNullException ( " uniqueMarker" ) ;
653+ throw new ArgumentNullException ( nameof ( uniqueMarker ) ) ;
654654 if ( String . IsNullOrEmpty ( startAfter ) )
655- throw new ArgumentNullException ( " startAfter" ) ;
655+ throw new ArgumentNullException ( nameof ( startAfter ) ) ;
656656 if ( String . IsNullOrEmpty ( endAt ) )
657- throw new ArgumentNullException ( " endAt" ) ;
657+ throw new ArgumentNullException ( nameof ( endAt ) ) ;
658658
659659 if ( String . IsNullOrEmpty ( fromText ) ) return null ;
660660
661- var markerPos = fromText . IndexOf ( uniqueMarker ) ;
661+ var markerPos = fromText . IndexOf ( uniqueMarker , StringComparison . Ordinal ) ;
662662 if ( markerPos == - 1 ) return null ;
663663
664- var startPos = fromText . IndexOf ( startAfter , markerPos ) ;
664+ var startPos = fromText . IndexOf ( startAfter , markerPos , StringComparison . Ordinal ) ;
665665 if ( startPos == - 1 ) return null ;
666666 startPos += startAfter . Length ;
667667
668- var endPos = fromText . IndexOf ( endAt , startPos ) ;
668+ var endPos = fromText . IndexOf ( endAt , startPos , StringComparison . Ordinal ) ;
669669 if ( endPos == - 1 ) endPos = fromText . Length ;
670670
671671 return fromText . Substring ( startPos , endPos - startPos ) ;
@@ -881,7 +881,7 @@ public static string ToHttps(this string url)
881881 {
882882 if ( url == null )
883883 {
884- throw new ArgumentNullException ( " url" ) ;
884+ throw new ArgumentNullException ( nameof ( url ) ) ;
885885 }
886886 return HttpRegex . Replace ( url . Trim ( ) , "https://" ) ;
887887 }
0 commit comments