summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2022-09-24 12:36:56 -0400
committerBenjamin Chausse <benjamin@chausse.xyz>2022-09-24 12:36:56 -0400
commitcef9f7ad1bdc417b82fff594b0b01fc7078a272e (patch)
tree22626578a212d76e2c04bc7fe5ef353e76b46687
parentb1117af2d9167204585be3671ecabebadc1de1f5 (diff)
Can detect if a char is in a string
-rw-r--r--findChar.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/findChar.h b/findChar.h
new file mode 100644
index 0000000..3d46e93
--- /dev/null
+++ b/findChar.h
@@ -0,0 +1,25 @@
+/* findChar.h
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <benjamin@chausse.xyz> wrote this file. As long as you retain this notice
+ * you can do whatever you want with this stuff. If we meet some day, and you
+ * think this stuff is worth it, you can buy me a beer in return.
+ * Benjamin Chausse
+ * ----------------------------------------------------------------------------
+ */
+
+
+// This returns TRUE
+int findChar(char *s,char target){
+ char *str = lower(trim(s));
+ int match = 0;
+ str = lower(str);
+ // Add if finding the index is necessary:
+ // str = trim(str);
+ for (int i=0;i<COUNT_OF(str); i++){
+ if (str[i] == target) {
+ match ++;
+ };
+ };
+ return (match>0) ? TRUE : FALSE;
+}