diff options
| author | Riccardo Spagni <ric@spagni.net> | 2017-12-17 12:58:46 +0200 |
|---|---|---|
| committer | Riccardo Spagni <ric@spagni.net> | 2017-12-17 12:58:46 +0200 |
| commit | b806d9844e4cfdb94e7a2d175efdf41d5ad480ff (patch) | |
| tree | f90f634f25079749febf00618ac3160d204f2d7a /contrib/epee/src/string_tools.cpp | |
| parent | 38ecd0526e32f651892f2e04174404907a563e29 (diff) | |
| parent | 09ce03d612e54231694eee2fb9e5c807b2bfc341 (diff) | |
| download | monzero-core-b806d9844e4cfdb94e7a2d175efdf41d5ad480ff.tar.gz monzero-core-b806d9844e4cfdb94e7a2d175efdf41d5ad480ff.tar.xz monzero-core-b806d9844e4cfdb94e7a2d175efdf41d5ad480ff.zip | |
Merge pull request #2864
09ce03d6 move includes around to lessen overall load (moneromooo-monero)
Diffstat (limited to 'contrib/epee/src/string_tools.cpp')
| -rw-r--r-- | contrib/epee/src/string_tools.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/contrib/epee/src/string_tools.cpp b/contrib/epee/src/string_tools.cpp index d04b16b75..fd0254016 100644 --- a/contrib/epee/src/string_tools.cpp +++ b/contrib/epee/src/string_tools.cpp @@ -26,6 +26,8 @@ #include "string_tools.h" +#include <ctype.h> + #ifdef _WIN32 # include <winsock2.h> #else @@ -56,6 +58,16 @@ namespace string_tools return true; } + //---------------------------------------------------------------------------- + bool validate_hex(uint64_t length, const std::string& str) + { + if (str.size() != length) + return false; + for (char c: str) + if (!isxdigit(c)) + return false; + return true; + } } } |
