aboutsummaryrefslogtreecommitdiff
path: root/lib/cstr/cstr.h
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2022-12-14 18:26:49 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2022-12-14 18:26:49 +0100
commitd179f1846f9372920ef02f08cfb4d3abe99b383f (patch)
tree4b6ddc71566be95a1ce520ef9d957f4cac1af6c9 /lib/cstr/cstr.h
first commit
Diffstat (limited to 'lib/cstr/cstr.h')
-rw-r--r--lib/cstr/cstr.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/cstr/cstr.h b/lib/cstr/cstr.h
new file mode 100644
index 0000000..80dc359
--- /dev/null
+++ b/lib/cstr/cstr.h
@@ -0,0 +1,23 @@
+#ifndef CSTR_H
+#define CSTR_H
+
+#include "../sys/sizes.h"
+
+u64 cstr_length(const char *);
+i8 cstr_compare(const char *a, const char *b);
+u64 cstr_split(char *cstr, char split);
+const char *next_split(const char *previous);
+u64 strip_front(char *cstr, char strip);
+u64 strip_back(char *cstr, char strip);
+u64 strip_cstr(char *cstr, char strip);
+
+u64 cstr_utf8_length(const char *);
+u8 next_utf8(const char **);
+u8 previous_utf8(const char **);
+
+void u64_to_cstr(u64 n, char *cstr, u64 length);
+void i64_to_cstr(i64 n, char *cstr, u64 length);
+u64 cstr_to_u64(const char *cstr);
+i64 cstr_to_i64(const char *cstr);
+
+#endif