aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authorHampus <hampus@hampusmat.com>2021-12-14 00:01:35 +0100
committerHampus <hampus@hampusmat.com>2021-12-14 00:01:35 +0100
commit88d8be06f3e5411db6faa59db12210b6079f7d21 (patch)
tree8e05fca5d76cb8734fc30e50297471ca72cdaa20 /src/utils.c
parentaf93edd8433634d82e855e9c9bcbca249a476977 (diff)
refactor: restructure project
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
new file mode 100644
index 0000000..ce3dcd4
--- /dev/null
+++ b/src/utils.c
@@ -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