string: add ispunct

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2024-08-19 09:25:23 +02:00
parent a95409c9ed
commit 98e8756808

View File

@ -147,6 +147,17 @@ namespace stdex
return chr == ' ' || chr == '\t' || chr == '\n' || chr == '\r' || chr == '\v' || chr == '\f';
}
///
/// Test if the given code unit is ASCII-punctuation
///
/// \param[in] chr Code unit
///
template <class T>
bool ispunct(_In_ T chr)
{
return ('!' <= chr && chr <= '/') || (':' <= chr && chr <= '@') || ('[' <= chr && chr <= '`') || ('{' <= chr && chr <= '~');
}
///
/// Test if the given code unit is ASCII-lower-case-character
///