diff --git a/src/public/tier1/strtools.h b/src/public/tier1/strtools.h index 0188f310..baa6312e 100644 --- a/src/public/tier1/strtools.h +++ b/src/public/tier1/strtools.h @@ -67,6 +67,7 @@ const char* V_strnchr(const char* pStr, char c, ssize_t n); bool V_isspace(int c); inline bool V_isalnum(char c) { return isalnum((unsigned char)c) != 0; } +bool V_IsAllDigit(const char* pString); // this is locale-unaware and therefore faster version of standard isdigit() // It also avoids sign-extension errors. diff --git a/src/tier1/strtools.cpp b/src/tier1/strtools.cpp index 727bc5e0..4e7b5527 100644 --- a/src/tier1/strtools.cpp +++ b/src/tier1/strtools.cpp @@ -242,6 +242,21 @@ bool V_isspace(int c) #endif } +bool V_IsAllDigit(const char* pString) +{ + while (*pString) + { + if (!V_isdigit(*pString)) + { + return false; + } + + pString++; + } + + return true; +} + //----------------------------------------------------------------------------- // Purpose: // Input : *in -