diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-04-01 10:53:44 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-04-01 10:53:44 +0300 |
| commit | ad18c24e7223b1c0d48a20ba9b618c4eaf1e3a84 (patch) | |
| tree | 86f3cba0b5b4bf4b7e49b96ceb61bec8b0be2780 /include/cu/string.h | |
| parent | b8211cda90f8a9cb14657d3328cfa9ec78722c5c (diff) | |
| download | ek-ad18c24e7223b1c0d48a20ba9b618c4eaf1e3a84.tar.gz ek-ad18c24e7223b1c0d48a20ba9b618c4eaf1e3a84.zip | |
fix gitignore
Diffstat (limited to 'include/cu/string.h')
| -rw-r--r-- | include/cu/string.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/cu/string.h b/include/cu/string.h new file mode 100644 index 0000000..75d7c62 --- /dev/null +++ b/include/cu/string.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-3.0-or-later */ + +#ifndef CT_STRING_H +#define CT_STRING_H + +#include <stddef.h> +#include <string.h> +#include <stdbool.h> + +struct string { + size_t len; + char *buf; +}; + +struct string *new_string(const char *s); +void destroy_string(struct string *s); + +int str_append(struct string *s, char c); +int str_concat(struct string *s, const char *c); +int str_add(struct string *s, struct string *c); + +char str_index(struct string *s, size_t i); +char str_rindex(struct string *s, size_t i); + +bool str_compare(struct string *s, const char *c); +void str_clear(struct string *s); + +#endif /* CT_STRING_H */ |
