summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2023-01-26 17:24:05 +0200
committerAhmad Samir <a.samirh78@gmail.com>2023-01-30 21:45:11 +0200
commita4f18c6d0db5b7a5da64e7a01cf7e10034b61c35 (patch)
treedeb34c09b8a181b3654254424556f886bd63fdda
parent763884cfb7be0cadd353cfa3b9b760d521851718 (diff)
QtMiscUtils: add isAsciiDigit helper
This logic is used in various places in qtbase, put it in one place. Change-Id: I731b1ce0c7b38fd42a91799a0565aafa94d4e9d0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/tools/qtools_p.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/tools/qtools_p.h b/src/corelib/tools/qtools_p.h
index 2058f6349e..b0fc13bbba 100644
--- a/src/corelib/tools/qtools_p.h
+++ b/src/corelib/tools/qtools_p.h
@@ -49,6 +49,11 @@ constexpr inline int fromOct(uint c) noexcept
return ((c >= '0') && (c <= '7')) ? int(c - '0') : -1;
}
+[[nodiscard]] constexpr inline bool isAsciiDigit(uchar c) noexcept
+{
+ return c >= '0' && c <= '9';
+}
+
constexpr inline char toAsciiLower(char ch) noexcept
{
return (ch >= 'A' && ch <= 'Z') ? ch - 'A' + 'a' : ch;