@@ -7,86 +7,86 @@ namespace YANLib;
77public static partial class YANText
88{
99
10- public static bool IsNull ( [ NotNullWhen ( false ) ] this string str ) => str is null ;
10+ public static bool IsNull ( [ NotNullWhen ( false ) ] this string ? str ) => str is null ;
1111
12- public static bool AllNull ( params string [ ] strs ) => strs is not null && ! strs . Any ( s => s . IsNotNull ( ) ) ;
12+ public static bool AllNull ( params string ? [ ] strs ) => strs is not null && ! strs . Any ( s => s . IsNotNull ( ) ) ;
1313
14- public static bool AnyNull ( params string [ ] strs ) => strs is not null && strs . Any ( s => s . IsNull ( ) ) ;
14+ public static bool AnyNull ( params string ? [ ] strs ) => strs is not null && strs . Any ( s => s . IsNull ( ) ) ;
1515
16- public static bool AllNull ( this IEnumerable < string > strs ) => strs is not null && ! strs . Any ( s => s . IsNotNull ( ) ) ;
16+ public static bool AllNull ( this IEnumerable < string ? > strs ) => strs is not null && ! strs . Any ( s => s . IsNotNull ( ) ) ;
1717
18- public static bool AnyNull ( this IEnumerable < string > strs ) => strs is not null && strs . Any ( s => s . IsNull ( ) ) ;
18+ public static bool AnyNull ( this IEnumerable < string ? > strs ) => strs is not null && strs . Any ( s => s . IsNull ( ) ) ;
1919
20- public static bool IsEmptyOrNull ( [ NotNullWhen ( false ) ] this string str ) => string . IsNullOrEmpty ( str ) ;
20+ public static bool IsEmptyOrNull ( [ NotNullWhen ( false ) ] this string ? str ) => string . IsNullOrEmpty ( str ) ;
2121
22- public static bool AllEmptyOrNull ( params string [ ] strs ) => strs is not null && ! strs . Any ( s => s . IsNotEmptyAndNull ( ) ) ;
22+ public static bool AllEmptyOrNull ( params string ? [ ] strs ) => strs is not null && ! strs . Any ( s => s . IsNotEmptyAndNull ( ) ) ;
2323
24- public static bool AnyEmptyOrNull ( params string [ ] strs ) => strs is not null && strs . Any ( s => s . IsEmptyOrNull ( ) ) ;
24+ public static bool AnyEmptyOrNull ( params string ? [ ] strs ) => strs is not null && strs . Any ( s => s . IsEmptyOrNull ( ) ) ;
2525
26- public static bool AllEmptyOrNull ( this IEnumerable < string > strs ) => strs is not null && ! strs . Any ( s => s . IsNotEmptyAndNull ( ) ) ;
26+ public static bool AllEmptyOrNull ( this IEnumerable < string ? > strs ) => strs is not null && ! strs . Any ( s => s . IsNotEmptyAndNull ( ) ) ;
2727
28- public static bool AnyEmptyOrNull ( this IEnumerable < string > strs ) => strs is not null && strs . Any ( s => s . IsEmptyOrNull ( ) ) ;
28+ public static bool AnyEmptyOrNull ( this IEnumerable < string ? > strs ) => strs is not null && strs . Any ( s => s . IsEmptyOrNull ( ) ) ;
2929
30- public static bool IsWhiteSpaceOrNull ( [ NotNullWhen ( false ) ] this string str ) => string . IsNullOrWhiteSpace ( str ) ;
30+ public static bool IsWhiteSpaceOrNull ( [ NotNullWhen ( false ) ] this string ? str ) => string . IsNullOrWhiteSpace ( str ) ;
3131
32- public static bool AllWhiteSpaceOrNull ( params string [ ] strs ) => strs is not null && ! strs . Any ( s => s . IsNotWhiteSpaceAndNull ( ) ) ;
32+ public static bool AllWhiteSpaceOrNull ( params string ? [ ] strs ) => strs is not null && ! strs . Any ( s => s . IsNotWhiteSpaceAndNull ( ) ) ;
3333
34- public static bool AnyWhiteSpaceOrNull ( params string [ ] strs ) => strs is not null && strs . Any ( s => s . IsWhiteSpaceOrNull ( ) ) ;
34+ public static bool AnyWhiteSpaceOrNull ( params string ? [ ] strs ) => strs is not null && strs . Any ( s => s . IsWhiteSpaceOrNull ( ) ) ;
3535
36- public static bool AllWhiteSpaceOrNull ( this IEnumerable < string > strs ) => strs is not null && ! strs . Any ( s => s . IsNotWhiteSpaceAndNull ( ) ) ;
36+ public static bool AllWhiteSpaceOrNull ( this IEnumerable < string ? > strs ) => strs is not null && ! strs . Any ( s => s . IsNotWhiteSpaceAndNull ( ) ) ;
3737
38- public static bool AnyWhiteSpaceOrNull ( this IEnumerable < string > strs ) => strs is not null && strs . Any ( s => s . IsWhiteSpaceOrNull ( ) ) ;
38+ public static bool AnyWhiteSpaceOrNull ( this IEnumerable < string ? > strs ) => strs is not null && strs . Any ( s => s . IsWhiteSpaceOrNull ( ) ) ;
3939
40- public static bool EqualsIgnoreCase ( this string str1 , string str2 ) => AllNull ( str1 , str2 ) || str1 . IsNotNull ( ) && str1 . IsNotNull ( ) && string . Equals ( str1 , str2 , OrdinalIgnoreCase ) ;
40+ public static bool EqualsIgnoreCase ( this string ? str1 , string ? str2 ) => AllNull ( str1 , str2 ) || str1 . IsNotNull ( ) && str1 . IsNotNull ( ) && string . Equals ( str1 , str2 , OrdinalIgnoreCase ) ;
4141
42- public static bool AllEqualsIgnoreCase ( params string [ ] strs ) => strs is not null && ! strs . Any ( s => s . NotEqualsIgnoreCase ( strs [ 0 ] ) ) ;
42+ public static bool AllEqualsIgnoreCase ( params string ? [ ] strs ) => strs is not null && ! strs . Any ( s => s . NotEqualsIgnoreCase ( strs [ 0 ] ) ) ;
4343
44- public static bool AnyEqualsIgnoreCase ( params string [ ] strs ) => ! strs . AllNotEqualsIgnoreCase ( ) ;
44+ public static bool AnyEqualsIgnoreCase ( params string ? [ ] strs ) => ! strs . AllNotEqualsIgnoreCase ( ) ;
4545
46- public static bool AllEqualsIgnoreCase ( this IEnumerable < string > strs ) => strs is not null && ! strs . Any ( s => s . NotEqualsIgnoreCase ( strs . First ( ) ) ) ;
46+ public static bool AllEqualsIgnoreCase ( this IEnumerable < string ? > strs ) => strs is not null && ! strs . Any ( s => s . NotEqualsIgnoreCase ( strs . First ( ) ) ) ;
4747
48- public static bool AnyEqualsIgnoreCase ( this IEnumerable < string > strs ) => ! strs . AllNotEqualsIgnoreCase ( ) ;
48+ public static bool AnyEqualsIgnoreCase ( this IEnumerable < string ? > strs ) => ! strs . AllNotEqualsIgnoreCase ( ) ;
4949
50- public static bool IsNotNull ( [ NotNullWhen ( true ) ] this string str ) => str is not null ;
50+ public static bool IsNotNull ( [ NotNullWhen ( true ) ] this string ? str ) => str is not null ;
5151
52- public static bool AllNotNull ( params string [ ] strs ) => strs is not null && ! strs . Any ( s => s . IsNull ( ) ) ;
52+ public static bool AllNotNull ( params string ? [ ] strs ) => strs is not null && ! strs . Any ( s => s . IsNull ( ) ) ;
5353
54- public static bool AnyNotNull ( params string [ ] strs ) => strs is not null && strs . Any ( s => s . IsNotNull ( ) ) ;
54+ public static bool AnyNotNull ( params string ? [ ] strs ) => strs is not null && strs . Any ( s => s . IsNotNull ( ) ) ;
5555
56- public static bool AllNotNull ( this IEnumerable < string > strs ) => strs is not null && ! strs . Any ( s => s . IsNull ( ) ) ;
56+ public static bool AllNotNull ( this IEnumerable < string ? > strs ) => strs is not null && ! strs . Any ( s => s . IsNull ( ) ) ;
5757
58- public static bool AnyNotNull ( this IEnumerable < string > strs ) => strs is not null && strs . Any ( s => s . IsNotNull ( ) ) ;
58+ public static bool AnyNotNull ( this IEnumerable < string ? > strs ) => strs is not null && strs . Any ( s => s . IsNotNull ( ) ) ;
5959
60- public static bool IsNotEmptyAndNull ( [ NotNullWhen ( true ) ] this string str ) => ! string . IsNullOrEmpty ( str ) ;
60+ public static bool IsNotEmptyAndNull ( [ NotNullWhen ( true ) ] this string ? str ) => ! string . IsNullOrEmpty ( str ) ;
6161
62- public static bool AllNotEmptyAndNull ( params string [ ] strs ) => strs is not null && ! strs . Any ( s => s . IsEmptyOrNull ( ) ) ;
62+ public static bool AllNotEmptyAndNull ( params string ? [ ] strs ) => strs is not null && ! strs . Any ( s => s . IsEmptyOrNull ( ) ) ;
6363
64- public static bool AnyNotEmptyAndNull ( params string [ ] strs ) => strs is not null && strs . Any ( s => s . IsNotEmptyAndNull ( ) ) ;
64+ public static bool AnyNotEmptyAndNull ( params string ? [ ] strs ) => strs is not null && strs . Any ( s => s . IsNotEmptyAndNull ( ) ) ;
6565
66- public static bool AllNotEmptyAndNull ( this IEnumerable < string > strs ) => strs is not null && ! strs . Any ( s => s . IsEmptyOrNull ( ) ) ;
66+ public static bool AllNotEmptyAndNull ( this IEnumerable < string ? > strs ) => strs is not null && ! strs . Any ( s => s . IsEmptyOrNull ( ) ) ;
6767
68- public static bool AnyNotEmptyAndNull ( this IEnumerable < string > strs ) => strs is not null && strs . Any ( s => s . IsNotEmptyAndNull ( ) ) ;
68+ public static bool AnyNotEmptyAndNull ( this IEnumerable < string ? > strs ) => strs is not null && strs . Any ( s => s . IsNotEmptyAndNull ( ) ) ;
6969
70- public static bool IsNotWhiteSpaceAndNull ( [ NotNullWhen ( true ) ] this string str ) => ! string . IsNullOrWhiteSpace ( str ) ;
70+ public static bool IsNotWhiteSpaceAndNull ( [ NotNullWhen ( true ) ] this string ? str ) => ! string . IsNullOrWhiteSpace ( str ) ;
7171
72- public static bool AllNotWhiteSpaceAndNull ( params string [ ] strs ) => strs is not null && ! strs . Any ( s => s . IsWhiteSpaceOrNull ( ) ) ;
72+ public static bool AllNotWhiteSpaceAndNull ( params string ? [ ] strs ) => strs is not null && ! strs . Any ( s => s . IsWhiteSpaceOrNull ( ) ) ;
7373
74- public static bool AnyNotWhiteSpaceAndNull ( params string [ ] strs ) => strs is not null && strs . Any ( s => s . IsNotWhiteSpaceAndNull ( ) ) ;
74+ public static bool AnyNotWhiteSpaceAndNull ( params string ? [ ] strs ) => strs is not null && strs . Any ( s => s . IsNotWhiteSpaceAndNull ( ) ) ;
7575
76- public static bool AllNotWhiteSpaceAndNull ( this IEnumerable < string > strs ) => strs is not null && ! strs . Any ( s => s . IsWhiteSpaceOrNull ( ) ) ;
76+ public static bool AllNotWhiteSpaceAndNull ( this IEnumerable < string ? > strs ) => strs is not null && ! strs . Any ( s => s . IsWhiteSpaceOrNull ( ) ) ;
7777
78- public static bool AnyNotWhiteSpaceAndNull ( this IEnumerable < string > strs ) => strs is not null && strs . Any ( s => s . IsNotWhiteSpaceAndNull ( ) ) ;
78+ public static bool AnyNotWhiteSpaceAndNull ( this IEnumerable < string ? > strs ) => strs is not null && strs . Any ( s => s . IsNotWhiteSpaceAndNull ( ) ) ;
7979
80- public static bool NotEqualsIgnoreCase ( this string str1 , string str2 ) => AllNotNull ( str1 , str2 ) && ! string . Equals ( str1 , str2 , OrdinalIgnoreCase ) ;
80+ public static bool NotEqualsIgnoreCase ( this string ? str1 , string ? str2 ) => AllNotNull ( str1 , str2 ) && ! string . Equals ( str1 , str2 , OrdinalIgnoreCase ) ;
8181
82- public static bool AllNotEqualsIgnoreCase ( params string [ ] strs )
82+ public static bool AllNotEqualsIgnoreCase ( params string ? [ ] strs )
8383 {
8484 if ( strs is null || strs . Length < 2 )
8585 {
8686 return false ;
8787 }
8888
89- var hashSet = new HashSet < string > ( strs . Length , StringComparer . OrdinalIgnoreCase ) ;
89+ var hashSet = new HashSet < string ? > ( strs . Length , StringComparer . OrdinalIgnoreCase ) ;
9090
9191 for ( var i = 0 ; i < strs . Length ; i ++ )
9292 {
@@ -99,16 +99,16 @@ public static bool AllNotEqualsIgnoreCase(params string[] strs)
9999 return true ;
100100 }
101101
102- public static bool AnyNotEqualsIgnoreCase ( params string [ ] strs ) => ! strs . AllEqualsIgnoreCase ( ) ;
102+ public static bool AnyNotEqualsIgnoreCase ( params string ? [ ] strs ) => ! strs . AllEqualsIgnoreCase ( ) ;
103103
104- public static bool AllNotEqualsIgnoreCase ( this IEnumerable < string > strs )
104+ public static bool AllNotEqualsIgnoreCase ( this IEnumerable < string ? > strs )
105105 {
106106 if ( strs is null || strs . Count ( ) < 2 )
107107 {
108108 return false ;
109109 }
110110
111- var hashSet = new HashSet < string > ( strs . Count ( ) , StringComparer . OrdinalIgnoreCase ) ;
111+ var hashSet = new HashSet < string ? > ( strs . Count ( ) , StringComparer . OrdinalIgnoreCase ) ;
112112
113113 foreach ( var str in strs )
114114 {
@@ -121,17 +121,17 @@ public static bool AllNotEqualsIgnoreCase(this IEnumerable<string> strs)
121121 return true ;
122122 }
123123
124- public static bool AnyNotEqualsIgnoreCase ( this IEnumerable < string > strs ) => ! strs . AllEqualsIgnoreCase ( ) ;
124+ public static bool AnyNotEqualsIgnoreCase ( this IEnumerable < string ? > strs ) => ! strs . AllEqualsIgnoreCase ( ) ;
125125
126- public static string GetValue ( this string str ) => str ?? string . Empty ;
126+ public static string GetValue ( this string ? str ) => str ?? string . Empty ;
127127
128- public static string GetValue ( this string str , string dfltVal ) => str ?? dfltVal ;
128+ public static string GetValue ( this string ? str , string dfltVal ) => str ?? dfltVal ;
129129
130- public static string GetValue ( this string str , char dfltVal ) => str ?? ( dfltVal . IsNotEmpty ( ) ? dfltVal . ToString ( ) : string . Empty ) ;
130+ public static string GetValue ( this string ? str , char dfltVal ) => str ?? ( dfltVal . IsNotEmpty ( ) ? dfltVal . ToString ( ) : string . Empty ) ;
131131
132- public static string ToLower ( this string str ) => str . IsNotWhiteSpaceAndNull ( ) ? str . ToLower ( ) : str ;
132+ public static string ? ToLower ( this string ? str ) => str . IsNotWhiteSpaceAndNull ( ) ? str . ToLower ( ) : str ;
133133
134- public static IEnumerable < string > ToLower ( this IEnumerable < string > strs )
134+ public static IEnumerable < string ? > ToLower ( this IEnumerable < string ? > strs )
135135 {
136136 if ( strs . IsEmptyOrNull ( ) )
137137 {
@@ -144,9 +144,9 @@ public static IEnumerable<string> ToLower(this IEnumerable<string> strs)
144144 }
145145 }
146146
147- public static string ToLowerInvariant ( this string str ) => str . IsNotWhiteSpaceAndNull ( ) ? str . ToLower ( CultureInfo . InvariantCulture ) : str ;
147+ public static string ? ToLowerInvariant ( this string ? str ) => str . IsNotWhiteSpaceAndNull ( ) ? str . ToLower ( CultureInfo . InvariantCulture ) : str ;
148148
149- public static IEnumerable < string > ToLowerInvariant ( this IEnumerable < string > strs )
149+ public static IEnumerable < string ? > ToLowerInvariant ( this IEnumerable < string ? > strs )
150150 {
151151 if ( strs . IsEmptyOrNull ( ) )
152152 {
@@ -159,9 +159,9 @@ public static IEnumerable<string> ToLowerInvariant(this IEnumerable<string> strs
159159 }
160160 }
161161
162- public static string ToUpper ( this string str ) => str . IsNotWhiteSpaceAndNull ( ) ? str . ToUpper ( ) : str ;
162+ public static string ? ToUpper ( this string ? str ) => str . IsNotWhiteSpaceAndNull ( ) ? str . ToUpper ( ) : str ;
163163
164- public static IEnumerable < string > ToUpper ( this IEnumerable < string > strs )
164+ public static IEnumerable < string ? > ToUpper ( this IEnumerable < string ? > strs )
165165 {
166166 if ( strs . IsEmptyOrNull ( ) )
167167 {
@@ -174,9 +174,9 @@ public static IEnumerable<string> ToUpper(this IEnumerable<string> strs)
174174 }
175175 }
176176
177- public static string ToUpperInvariant ( this string str ) => str . IsNotWhiteSpaceAndNull ( ) ? str . ToUpper ( CultureInfo . InvariantCulture ) : str ;
177+ public static string ? ToUpperInvariant ( this string ? str ) => str . IsNotWhiteSpaceAndNull ( ) ? str . ToUpper ( CultureInfo . InvariantCulture ) : str ;
178178
179- public static IEnumerable < string > ToUpperInvariant ( this IEnumerable < string > strs )
179+ public static IEnumerable < string ? > ToUpperInvariant ( this IEnumerable < string ? > strs )
180180 {
181181 if ( strs . IsEmptyOrNull ( ) )
182182 {
0 commit comments