Q_strisnum shared helper function

This commit is contained in:
BjossiAlfreds 2024-10-16 13:54:38 +00:00
parent aae0524687
commit 8d5d86cbaf
2 changed files with 15 additions and 0 deletions

View file

@ -335,6 +335,7 @@ void Q_strdel(char *s, size_t i, size_t n);
/* Insert src into dest starting at index i, total, n is the total size of the buffer */
/* Returns length of src on success, 0 if there is not enough space in dest for src */
size_t Q_strins(char *dest, const char *src, size_t i, size_t n);
qboolean Q_strisnum(const char *s);
/* ============================================= */

View file

@ -1190,6 +1190,20 @@ Q_strins(char *dest, const char *src, size_t i, size_t n)
return slen;
}
qboolean
Q_strisnum(const char *s)
{
for (; *s != '\0'; s++)
{
if (!isdigit(*s))
{
return false;
}
}
return true;
}
/*
* An unicode compatible fopen() Wrapper for Windows.
*/