aboutsummaryrefslogtreecommitdiff
path: root/include/str.h
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2023-10-26 19:53:29 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2023-10-26 19:53:29 -0400
commit17178535cc9df5e834dfd43e3b2b919e02e5798d (patch)
tree5e55e8b2c2453ccf6271b190cf45e90d2c25179d /include/str.h
downloadstasis-17178535cc9df5e834dfd43e3b2b919e02e5798d.tar.gz
Initial commit
Diffstat (limited to 'include/str.h')
-rw-r--r--include/str.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/include/str.h b/include/str.h
new file mode 100644
index 0000000..1c67eda
--- /dev/null
+++ b/include/str.h
@@ -0,0 +1,47 @@
+/**
+ * @file str.h
+ */
+#ifndef SPM_STR_H
+#define SPM_STR_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <ctype.h>
+#include "ohmycal.h"
+
+#define SPM_SORT_ALPHA 1 << 0
+#define SPM_SORT_NUMERIC 1 << 1
+#define SPM_SORT_LEN_ASCENDING 1 << 2
+#define SPM_SORT_LEN_DESCENDING 1 << 3
+
+int num_chars(const char *sptr, int ch);
+int startswith(const char *sptr, const char *pattern);
+int endswith(const char *sptr, const char *pattern);
+char *normpath(const char *path);
+void strchrdel(char *sptr, const char *chars);
+long int strchroff(const char *sptr, int ch);
+void strdelsuffix(char *sptr, const char *suffix);
+char** split(char *sptr, const char* delim, size_t max);
+void split_free(char **ptr);
+char *join(char **arr, const char *separator);
+char *join_ex(char *separator, ...);
+char *substring_between(char *sptr, const char *delims);
+void strsort(char **arr, unsigned int sort_mode);
+int isrelational(char ch);
+void print_banner(const char *s, int len);
+char *strstr_array(char **arr, const char *str);
+char **strdeldup(char **arr);
+char *lstrip(char *sptr);
+char *strip(char *sptr);
+int isempty(char *sptr);
+int isquoted(char *sptr);
+char *normalize_space(char *s);
+char **strdup_array(char **array);
+int strcmp_array(const char **a, const char **b);
+int isdigit_s(const char *s);
+char *tolower_s(char *s);
+char *to_short_version(const char *s);
+
+#endif //SPM_STR_H