From d179f1846f9372920ef02f08cfb4d3abe99b383f Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Wed, 14 Dec 2022 18:26:49 +0100 Subject: first commit --- lib/cstr/cstr.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lib/cstr/cstr.h (limited to 'lib/cstr/cstr.h') 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 -- cgit v1.2.3-70-g09d2