ascii: add try_lower
This commit is contained in:
parent
5fb87ea4c4
commit
35ae04510f
13
ascii.hpp
13
ascii.hpp
@ -131,6 +131,19 @@ namespace cruft::ascii {
|
||||
}
|
||||
|
||||
|
||||
///------------------------------------------------------------------------
|
||||
/// Convert an ASCII character into a lower case character if it is upper
|
||||
/// case, else return it unchanged.
|
||||
///
|
||||
/// If you know the character is always upper case then prefer to_lower.
|
||||
constexpr inline
|
||||
char
|
||||
try_lower (char c) noexcept
|
||||
{
|
||||
return is_upper (c) ? to_lower (c) : c;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/// Returns true if the supplied ASCII character is whitespace.
|
||||
constexpr inline
|
||||
|
Loading…
Reference in New Issue
Block a user