| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- #ifndef TOOLBOX_STR_H
- #define TOOLBOX_STR_H
- #include <stddef.h>
- #include "toolbox/errno.h"
- #ifdef TOOLBOX_TYPEDEF
- typedef struct str str_st;
- #endif
- struct str {
- char *data;
- char *_c_data;
- size_t size;
- size_t _c_size;
- };
- struct str*
- str_create(const char *cstring, size_t cstring_size);
- struct str*
- str_create_ns(const char *cstring);
- RET_TYPE
- str_destroy(struct str *str);
- RET_TYPE
- str_to_lowercase(struct str *str);
- RET_TYPE
- str_to_uppercase(struct str *str);
- RET_TYPE
- str_to_titlecase(struct str *str);
- _Bool
- str_starts_with(struct str *str, struct str* start);
- _Bool
- str_starts_with_char(struct str *str, char chr);
- _Bool
- str_starts_with_cstring(struct str *str, char *cstring, size_t cstring_size);
- _Bool
- str_starts_with_cstring_ns(struct str *str, char *cstring);
- _Bool
- str_ends_with(struct str *str, struct str* end);
- _Bool
- str_ends_with_char(struct str *str, char chr);
- _Bool
- str_ends_with_cstring(struct str *str, char *cstring, size_t cstring_size);
- _Bool
- str_ends_with_cstring_ns(struct str *str, char *cstring);
- _Bool
- str_is_empty(struct str *str);
- size_t
- str_count_str(struct str *str, struct str *str2);
- size_t
- str_count_char(struct str *str, char chr);
- size_t
- str_count_cstring(struct str *str, char *cstring, size_t cstring_size);
- size_t
- str_count_cstring_ns(struct str *str, char *cstring);
- // reverse
- // append
- // prepend
- // trim_left
- // trim_right
- // trim
- // split
- // split_limit
- // equal
- // iequal
- // cmp
- // icmp
- // in_array
- // in_list
- // contains
- // to_cstring
- // to_char
- // to_short
- // to_int
- // to_long
- // to_float
- // to_double
- // formatted
- // join
- #endif
|