aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/util.cpp6
-rw-r--r--common/util.h10
2 files changed, 16 insertions, 0 deletions
diff --git a/common/util.cpp b/common/util.cpp
index 62a1baf6ac..a6c7958a0d 100644
--- a/common/util.cpp
+++ b/common/util.cpp
@@ -23,6 +23,7 @@
#define FORBIDDEN_SYMBOL_EXCEPTION_isalnum
#define FORBIDDEN_SYMBOL_EXCEPTION_isalpha
#define FORBIDDEN_SYMBOL_EXCEPTION_isdigit
+#define FORBIDDEN_SYMBOL_EXCEPTION_isxdigit
#define FORBIDDEN_SYMBOL_EXCEPTION_isnumber
#define FORBIDDEN_SYMBOL_EXCEPTION_islower
#define FORBIDDEN_SYMBOL_EXCEPTION_isspace
@@ -132,6 +133,11 @@ bool isDigit(int c) {
return isdigit((byte)c);
}
+bool isXDigit(int c) {
+ ENSURE_ASCII_CHAR(c);
+ return isxdigit((byte)c);
+}
+
bool isLower(int c) {
ENSURE_ASCII_CHAR(c);
return islower((byte)c);
diff --git a/common/util.h b/common/util.h
index 77d7523034..5f853da43a 100644
--- a/common/util.h
+++ b/common/util.h
@@ -142,6 +142,16 @@ bool isAlpha(int c);
bool isDigit(int c);
/**
+ * Test whether the given character is a hwzadecimal-digit (0-9 or A-F).
+ * If the parameter is outside the range of a signed or unsigned char, then
+ * false is returned.
+ *
+ * @param c the character to test
+ * @return true if the character is a hexadecimal-digit, false otherwise.
+ */
+bool isXDigit(int c);
+
+/**
* Test whether the given character is a lower-case letter (a-z).
* If the parameter is outside the range of a signed or unsigned char, then
* false is returned.