Added x_isnumber function

This commit is contained in:
xavi 2024-09-22 17:48:37 -07:00
parent c69f18a479
commit 609d2d4d77
2 changed files with 12 additions and 0 deletions

View File

@ -11,3 +11,14 @@ int x_isdigit(const char x){
return 0;
}
int x_isnumber(const char* str){
const char * ptr;
for (ptr = str; *ptr != '\0'; ptr++){
if ( !x_isdigit(*ptr) ){
return 0;
}
}
return 1;
}

View File

@ -4,5 +4,6 @@
// returns 0 if x is not a digit and 1 if it is
int x_isdigit(char x);
int x_isnumber(char *str);
#endif