// Kyler Olsen // YREA SLS // Strings Header // November 2025 #ifndef SLS_STRING_H #define SLS_STRING_H #include #include #include #include "bool.h" typedef struct { size_t len; // Number of useable characters (does not include trailing null character) char *str; Boolean allocated; } SlsStr; #define SLS_STR(s) (SlsStr){ sizeof(s) - 1, (s), FALSE } #define SLS_STR_NULL (SlsStr){0, NULL, FALSE} int sls_isascii(unsigned char c); size_t sls_str_nlen(const char *s, size_t maxlen); SlsStr sls_str_malloc(const char *s, size_t maxlen); SlsStr sls_str_new(size_t length); SlsStr sls_str_cpy(SlsStr s); int32_t sls_str_cmp(SlsStr a, SlsStr b); void sls_str_free(SlsStr *s); SlsStr sls_format(const SlsStr s, ...); #endif // SLS_STRING_H