blob: 93f7c5347762a426d9021965b65cecd8d8f63c8b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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;
}
|