mirror of
https://github.com/NixOS/nix
synced 2025-07-07 01:51:47 +02:00
Add nix::isASCII*, locale-independent
This commit is contained in:
parent
1fa958dda1
commit
79eb2920bb
2 changed files with 76 additions and 0 deletions
17
src/libutil/string.hh
Normal file
17
src/libutil/string.hh
Normal file
|
@ -0,0 +1,17 @@
|
|||
#pragma once
|
||||
|
||||
namespace nix {
|
||||
|
||||
/** Locale-independent version of std::islower(). */
|
||||
inline bool isASCIILower(char c) { return c >= 'a' && c <= 'z'; };
|
||||
|
||||
/** Locale-independent version of std::isupper(). */
|
||||
inline bool isASCIIUpper(char c) { return c >= 'A' && c <= 'Z'; };
|
||||
|
||||
/** Locale-independent version of std::isalpha(). */
|
||||
inline bool isASCIIAlpha(char c) { return isASCIILower(c) || isASCIIUpper(c); };
|
||||
|
||||
/** Locale-independent version of std::isdigit(). */
|
||||
inline bool isASCIIDigit(char c) { return c >= '0' && c <= '9'; };
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue