Website Summary Files Commits Branches @commit @diff @stats
path: root / util.c
diff options
context:
space:
mode:
1 files changed, 9 insertions, 0 deletions
-rw-r--r--util.c9
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;
+}