diff options
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -0,0 +1,17 @@ +#include "utils.h" +#include <ctype.h> +#include <string.h> + +/** + * Returns whether or not a string is a number. + */ +int is_number(char *str) +{ + size_t len = strlen(str); + for (int c = 0; c < len; c++) + { + if (!isdigit(str[c])) + return 0; + } + return 1; +}
\ No newline at end of file |