summaryrefslogtreecommitdiff
path: root/src/utils/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/string.c')
-rw-r--r--src/utils/string.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/utils/string.c b/src/utils/string.c
new file mode 100644
index 0000000..81be415
--- /dev/null
+++ b/src/utils/string.c
@@ -0,0 +1,14 @@
+#include "string.h"
+
+#include <string.h>
+
+size_t searchInStringArray(const char *array[], size_t array_size,
+ const char *str, size_t str_size) {
+ for (size_t i = 0; i < array_size; ++i) {
+ const size_t el_size = strlen(array[i]);
+ if (el_size == str_size && strncmp(array[i], str, str_size) == 0) {
+ return i;
+ }
+ }
+ return array_size;
+}