mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-23 00:18:47 +00:00
✨ Add string.IsUpper and string.IsLower
- IsLower: Determines if all alpha characters in this string are considered lowercase. - IsUpper: Determines if all alpha characters in this string are considered uppercase.
This commit is contained in:
parent
72f9474e1c
commit
11ffa43810
@ -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
|
||||
|
@ -145,6 +145,28 @@
|
||||
return encoding.GetBytes(str);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if all alpha characters in this string are considered lowercase.
|
||||
/// </summary>
|
||||
/// <param name="str">The input string.</param>
|
||||
/// <returns>Returns <see langword="true"/> if all alpha characters are lowercase, <see langword="false"/>
|
||||
/// otherwise.</returns>
|
||||
public static bool IsLower(this string str)
|
||||
{
|
||||
return str.Where(char.IsLetter).All(char.IsLower);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if all alpha characters in this string are considered uppercase.
|
||||
/// </summary>
|
||||
/// <param name="str">The input string.</param>
|
||||
/// <returns>Returns <see langword="true"/> if all alpha characters are uppercase, <see langword="false"/>
|
||||
/// otherwise.</returns>
|
||||
public static bool IsUpper(this string str)
|
||||
{
|
||||
return str.Where(char.IsLetter).All(char.IsUpper);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a new random string by filling it with characters found in <see cref="str"/>.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user