aboutsummaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/util.c b/util.c
index 5f847fa..822a4d2 100644
--- a/util.c
+++ b/util.c
@@ -169,3 +169,12 @@ int isNumber(char* str) {
}
return 1;
}
+
+int charCount(char* str, char cmp) {
+ int count = 0;
+ while (*str != '\0') {
+ count += *str == cmp;
+ str++;
+ }
+ return count;
+}