@@ -39,22 +39,22 @@ public static string StrTr(this string src, string fromChars, string toChars)
39
39
// string, string (with array of Tuples), Ordinal
40
40
public static string StrTr ( this string src , params ( string , string ) [ ] replacePairs )
41
41
{
42
- string newsrc = src . StrTr ( replacePairs , StringComparison . Ordinal ) ;
43
- return newsrc ;
42
+ string newsrc = src . StrTr ( replacePairs , StringComparison . Ordinal ) ;
43
+ return newsrc ;
44
44
45
45
}
46
46
47
47
48
48
/********************************* IEnumerable **********************************/
49
49
50
- // string => string (with IEnumerable of KeyValuePairs<string, string>)
50
+ // string => string (with IEnumerable of KeyValuePairs<string, string> and StringComparison )
51
51
public static string StrTr ( this string src , IEnumerable < KeyValuePair < string , string > > replacePairs , StringComparison mode = StringComparison . Ordinal )
52
52
{
53
53
StringBuilder sb = new StringBuilder ( ) ;
54
54
int srcoffs = 0 ;
55
55
string srctail ;
56
56
bool done ;
57
- IEnumerable < KeyValuePair < string , string > > orderedPairs = replacePairs . Where ( rp => rp . Key != "" ) . OrderByDescending ( rp => rp . Key . Length ) ;
57
+ IEnumerable < KeyValuePair < string , string > > orderedPairs = replacePairs . Where ( rp => rp . Key != "" ) . OrderByDescending ( rp => rp . Key . Length ) ;
58
58
while ( srcoffs < src . Length )
59
59
{
60
60
srctail = src . Substring ( srcoffs ) ;
@@ -79,14 +79,14 @@ public static string StrTr(this string src, IEnumerable<KeyValuePair<string, str
79
79
}
80
80
81
81
82
- // string => string (with IEnumerable of Tuples<string, string>)
82
+ // string => string (with IEnumerable of Tuples<string, string> and StringComparison )
83
83
public static string StrTr ( this string src , IEnumerable < ( string , string ) > replacePairs , StringComparison mode = StringComparison . Ordinal )
84
84
{
85
85
StringBuilder sb = new StringBuilder ( ) ;
86
86
int srcoffs = 0 ;
87
87
string srctail ;
88
88
bool done ;
89
- IEnumerable < ( string , string ) > orderedPairs = replacePairs . Where ( rp => rp . Item1 != "" ) . OrderByDescending ( rp => rp . Item1 . Length ) ;
89
+ IEnumerable < ( string , string ) > orderedPairs = replacePairs . Where ( rp => rp . Item1 != "" ) . OrderByDescending ( rp => rp . Item1 . Length ) ;
90
90
while ( srcoffs < src . Length )
91
91
{
92
92
srctail = src . Substring ( srcoffs ) ;
@@ -112,14 +112,14 @@ public static string StrTr(this string src, IEnumerable<(string, string)> replac
112
112
113
113
114
114
115
- // string => string (with IEnumerable of KeyValuePairs<string, string>)
115
+ // string => string (with IEnumerable of KeyValuePairs<string, string> and CultureInfo )
116
116
public static string StrTr ( this string src , IEnumerable < KeyValuePair < string , string > > replacePairs , bool ignoreCase , System . Globalization . CultureInfo culture = null )
117
117
{
118
118
StringBuilder sb = new StringBuilder ( ) ;
119
119
int srcoffs = 0 ;
120
120
string srctail ;
121
121
bool done ;
122
- IEnumerable < KeyValuePair < string , string > > orderedPairs = replacePairs . Where ( rp => rp . Key != "" ) . OrderByDescending ( rp => rp . Key . Length ) ;
122
+ IEnumerable < KeyValuePair < string , string > > orderedPairs = replacePairs . Where ( rp => rp . Key != "" ) . OrderByDescending ( rp => rp . Key . Length ) ;
123
123
while ( srcoffs < src . Length )
124
124
{
125
125
srctail = src . Substring ( srcoffs ) ;
@@ -144,14 +144,14 @@ public static string StrTr(this string src, IEnumerable<KeyValuePair<string, str
144
144
}
145
145
146
146
147
- // string => string (with IEnumerable of Tuples<string, string>)
147
+ // string => string (with IEnumerable of Tuples<string, string> and CultureInfo )
148
148
public static string StrTr ( this string src , IEnumerable < ( string , string ) > replacePairs , bool ignoreCase , System . Globalization . CultureInfo culture = null )
149
149
{
150
150
StringBuilder sb = new StringBuilder ( ) ;
151
151
int srcoffs = 0 ;
152
152
string srctail ;
153
153
bool done ;
154
- IEnumerable < ( string , string ) > orderedPairs = replacePairs . Where ( rp => rp . Item1 != "" ) . OrderByDescending ( rp => rp . Item1 . Length ) ;
154
+ IEnumerable < ( string , string ) > orderedPairs = replacePairs . Where ( rp => rp . Item1 != "" ) . OrderByDescending ( rp => rp . Item1 . Length ) ;
155
155
while ( srcoffs < src . Length )
156
156
{
157
157
srctail = src . Substring ( srcoffs ) ;
0 commit comments