diff --git a/CHANGELOG.md b/CHANGELOG.md index cdc64b2..df0983f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ### Added - Add `string.ChangeEncoding(Encoding, Encoding)` - Converts this string from one encoding to another +- Add `string.IsLower` + - Determines if all alpha characters in this string are considered lowercase +- Add `string.IsUpper` + - Determines if all alpha characters in this string are considered uppercase ### Changed - n/a diff --git a/X10D/src/StringExtensions.cs b/X10D/src/StringExtensions.cs index 0cc0dea..4743075 100644 --- a/X10D/src/StringExtensions.cs +++ b/X10D/src/StringExtensions.cs @@ -145,6 +145,28 @@ return encoding.GetBytes(str); } + /// + /// Determines if all alpha characters in this string are considered lowercase. + /// + /// The input string. + /// Returns if all alpha characters are lowercase, + /// otherwise. + public static bool IsLower(this string str) + { + return str.Where(char.IsLetter).All(char.IsLower); + } + + /// + /// Determines if all alpha characters in this string are considered uppercase. + /// + /// The input string. + /// Returns if all alpha characters are uppercase, + /// otherwise. + public static bool IsUpper(this string str) + { + return str.Where(char.IsLetter).All(char.IsUpper); + } + /// /// Generates a new random string by filling it with characters found in . ///