Added x_isnumber function
This commit is contained in:
parent
c69f18a479
commit
609d2d4d77
@ -11,3 +11,14 @@ int x_isdigit(const char x){
|
|||||||
return 0;
|
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;
|
||||||
|
}
|
||||||
|
@ -4,5 +4,6 @@
|
|||||||
|
|
||||||
// returns 0 if x is not a digit and 1 if it is
|
// returns 0 if x is not a digit and 1 if it is
|
||||||
int x_isdigit(char x);
|
int x_isdigit(char x);
|
||||||
|
int x_isnumber(char *str);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user