Add str_isallnum_hex

To check if string contains only `[0-9a-zA-Z]`.
This commit is contained in:
Robert Müller 2023-06-20 23:01:55 +02:00
parent bb5e203f3a
commit 0aa55e224c
2 changed files with 15 additions and 0 deletions

View file

@ -3430,6 +3430,17 @@ int str_isallnum(const char *str)
return 1;
}
int str_isallnum_hex(const char *str)
{
while(*str)
{
if(!(*str >= '0' && *str <= '9') && !(*str >= 'a' && *str <= 'f') && !(*str >= 'A' && *str <= 'F'))
return 0;
str++;
}
return 1;
}
int str_toint(const char *str)
{
return str_toint_base(str, 10);

View file

@ -2186,7 +2186,11 @@ float str_tofloat(const char *str);
int str_isspace(char c);
char str_uppercase(char c);
int str_isallnum(const char *str);
int str_isallnum_hex(const char *str);
unsigned str_quickhash(const char *str);
enum