mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Tier1: add V_IsAllDigit()
This function checks if a string consists of only numeric characters.
This commit is contained in:
parent
8da31dd15c
commit
0dd19ab2dd
@ -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.
|
||||
|
@ -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 -
|
||||
|
Loading…
x
Reference in New Issue
Block a user