Skip to content

Commit f6d8718

Browse files
authored
Merge pull request #54 from Tynab/develop
v3.2.2
2 parents 481e041 + dcfa87e commit f6d8718

File tree

3 files changed

+62
-76
lines changed

3 files changed

+62
-76
lines changed

lib/YANLib/YANLib.csproj

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,13 @@
1919
<PackageReadmeFile>README.md</PackageReadmeFile>
2020
<RepositoryType>git</RepositoryType>
2121
<PackageReleaseNotes>Update
22-
- Bool
23-
- Model
24-
- Num
25-
- Decimal
26-
- Double
27-
- Float
28-
- Int
29-
- Long
30-
- Nint
31-
- Nuint
32-
- Sbyte
33-
- Short
34-
- Uint
35-
- Ulong
36-
- Ushort
37-
- Pass
38-
- Random</PackageReleaseNotes>
22+
- Text
23+
- Char
24+
- String</PackageReleaseNotes>
3925
<PackageLicenseExpression>MIT</PackageLicenseExpression>
4026
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
4127
<PackageId>Tynab.YANLib</PackageId>
42-
<Version>3.2.1</Version>
28+
<Version>3.2.2</Version>
4329
<LangVersion>preview</LangVersion>
4430
</PropertyGroup>
4531

lib/YANLib/YANText.Char.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ public static partial class YANText
2525

2626
public static bool AnyWhiteSpace(this IEnumerable<char> cs) => cs is not null && cs.Any(c => c.IsWhiteSpace());
2727

28-
public static bool IsWhiteSpaceOrNull(this char c) => c.IsEmpty() || c.IsWhiteSpace();
28+
public static bool IsWhiteSpaceOrEmpty(this char c) => c.IsEmpty() || c.IsWhiteSpace();
2929

3030
public static bool AllWhiteSpaceOrNull(params char[] cs) => cs is not null && !cs.Any(c => c.IsNotEmptyAndWhiteSpace());
3131

32-
public static bool AnyWhiteSpaceOrNull(params char[] cs) => cs is not null && cs.Any(c => c.IsWhiteSpaceOrNull());
32+
public static bool AnyWhiteSpaceOrNull(params char[] cs) => cs is not null && cs.Any(c => c.IsWhiteSpaceOrEmpty());
3333

3434
public static bool AllWhiteSpaceOrNull(this IEnumerable<char> cs) => cs is not null && !cs.Any(c => c.IsNotEmptyAndWhiteSpace());
3535

36-
public static bool AnyWhiteSpaceOrNull(this IEnumerable<char> cs) => cs is not null && cs.Any(c => c.IsWhiteSpaceOrNull());
36+
public static bool AnyWhiteSpaceOrNull(this IEnumerable<char> cs) => cs is not null && cs.Any(c => c.IsWhiteSpaceOrEmpty());
3737

3838
public static bool IsAlphabetic(this char c) => char.IsLetter(c);
3939

@@ -97,11 +97,11 @@ public static partial class YANText
9797

9898
public static bool IsNotEmptyAndWhiteSpace(this char c) => c.IsNotEmpty() && c.IsNotWhiteSpace();
9999

100-
public static bool AllNotEmptyAndWhiteSpace(params char[] cs) => cs is not null && !cs.Any(c => c.IsWhiteSpaceOrNull());
100+
public static bool AllNotEmptyAndWhiteSpace(params char[] cs) => cs is not null && !cs.Any(c => c.IsWhiteSpaceOrEmpty());
101101

102102
public static bool AnyNotEmptyAndWhiteSpace(params char[] cs) => cs is not null && cs.Any(c => c.IsNotEmptyAndWhiteSpace());
103103

104-
public static bool AllNotEmptyAndWhiteSpace(this IEnumerable<char> cs) => cs is not null && !cs.Any(c => c.IsWhiteSpaceOrNull());
104+
public static bool AllNotEmptyAndWhiteSpace(this IEnumerable<char> cs) => cs is not null && !cs.Any(c => c.IsWhiteSpaceOrEmpty());
105105

106106
public static bool AnyNotEmptyAndWhiteSpace(this IEnumerable<char> cs) => cs is not null && cs.Any(c => c.IsNotEmptyAndWhiteSpace());
107107

lib/YANLib/YANText.String.cs

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -7,86 +7,86 @@ namespace YANLib;
77
public 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

Comments
 (0)