From 98e8756808993bd79d1d7b338537a4d92ff54428 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Mon, 19 Aug 2024 09:25:23 +0200 Subject: [PATCH] string: add ispunct Signed-off-by: Simon Rozman --- include/stdex/string.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/stdex/string.hpp b/include/stdex/string.hpp index 9f95c1032..1cb19db66 100644 --- a/include/stdex/string.hpp +++ b/include/stdex/string.hpp @@ -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 + 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 ///