cstring

Lightweight string library for C
git clone git://git.christosmarg.xyz/cstring.git
Log | Files | Refs | README | LICENSE

commit 82ce1614a60b43996cc101568cd6196b6a26ba23
parent 21d4d074f6424f434aa88c3213cbc898f14dbcde
Author: Christos Margiolis <christos@margiolis.net>
Date:   Thu, 24 Sep 2020 13:01:40 +0300

edited README

Diffstat:
MREADME.md | 75++++++++++++++++++++++++++++++++++++++-------------------------------------
1 file changed, 38 insertions(+), 37 deletions(-)

diff --git a/README.md b/README.md @@ -33,43 +33,44 @@ The recommended way of initializing an empty string is by doing `cstring foo = c ## Functions -* `cstring cstring_create(const char *s)`: Initiliaze string -* `void cstring_delete(cstring *cs)`: Deallocate string -* `void cstring_assign(cstring *cs, const char *s)`: Assign new string -* `void cstring_append(cstring *cs, const char *s)`: Append to end of string -* `void cstring_prepend(cstring *cs, const char *s)`: Prepend to beginning of string -* `void cstring_insert(cstring *cs, const char *s, size_t i)`: Insert to a specific index -* `void cstring_erase(cstring *cs, size_t pos, size_t len)`: Erase portion of string -* `void cstring_erase_matching(cstring *cs, const char *s)`: Erase first match -* `void cstring_erase_all_matching(cstring *cs, const char *s)`: Erase all matches -* `void cstring_trim(cstring *cs, char c)`: Trim character -* `void cstring_push_back(cstring *cs, char c)`: Add character to end of string -* `void cstring_pop_back(cstring *cs)`: Remove the last character from string -* `void cstring_replace_char(cstring *cs, size_t i, char c)`: Replace character at a specific index -* `void cstring_replace_str(cstring *cs, const char *s, size_t pos, size_t len)`: Replace portion of string -* `cstring cstring_substr(const cstring *cs, size_t pos, size_t len)`: Extract a substring -* `void cstring_swap(cstring *lhs, cstring *rhs)`: Swap contents of two strings -* `void cstring_shrink_to_fit(cstring *cs)`: Shrink string's capacity to fit its size -* `void cstring_clear(cstring *cs)`: Clear contents of string -* `size_t cstring_find(const cstring *cs, const char *s)`: Find index of first match (string) -* `size_t cstring_find_first_of(const cstring *cs, char c)`: Find index of first match (character) -* `size_t cstring_find_last_of(const cstring *cs, char c)`: Find index of last match (character) -* `char cstring_front(const cstring *cs)`: Get first character in string -* `char cstring_back(const cstring *cs)`: Get last character in string -* `int cstring_empty(const cstring *cs)`: Check if string is empty -* `int cstring_starts_with_str(const cstring *cs, const char *s)`: Check if string starts with `s` -* `int cstring_ends_with_str(const cstring *cs, const char *s)`: Check if string ends with `s` -* `int cstring_starts_with_char(const cstring *cs, char c)`: Check if string starts with `c` -* `int cstring_ends_with_char(const cstring *cs, char c)`: Check if string ends with `c` -* `char *cstring_copy(const char *cs)`: Copy contents of `s` -* `void cstring_resize(cstring *cs, size_t newcapacity)`: Resize string -* `cstring *cstring_getline(FILE *fd, cstring *cs, char delim)`: Read a line from a `FILE` stream -* `int cstring_equal(const cstring *lhs, const cstring *rhs)`: Check if strings are equal -* `int cstring_not_equal(const cstring *lhs, const cstring *rhs)`: Check if strings are not equal -* `int cstring_greater(const cstring *lhs, const cstring *rhs)`: Check if `lhs` is greater than `rhs` -* `int cstring_greater_or_equal(const cstring *lhs, const cstring *rhs)`: True `lhs` is greater of equal to `rhs` -* `int cstring_less(const cstring *lhs, const cstring *rhs)`: Check if `lhs` is less than `rhs` -* `int cstring_less_or_equal(const cstring *lhs, const cstring *rhs)`: Check if `lhs` is less or equal to `rhs` +* `cstring_create`: Initiliaze string +* `cstring_delete`: Deallocate string +* `cstring_assign`: Assign new string +* `cstring_append`: Append to end of string +* `cstring_prepend`: Prepend to beginning of string +* `cstring_insert`: Insert to a specific index +* `cstring_erase`: Erase portion of string +* `cstring_erase_matching`: Erase first match +* `cstring_erase_all_matching`: Erase all matches +* `cstring_trim`: Trim character +* `cstring_push_back`: Add character to end of string +* `cstring_pop_back`: Remove the last character from string +* `cstring_replace_char`: Replace character at a specific index +* `cstring_replace_str`: Replace portion of string +* `cstring_substr`: Extract a substring +* `cstring_swap`: Swap contents of two strings +* `cstring_shrink_to_fit`: Shrink string's capacity to fit its size +* `cstring_clear`: Clear contents of string +* `cstring_find`: Find index of first match (string) +* `cstring_find_first_of`: Find index of first match (character) +* `cstring_find_last_of`: Find index of last match (character) +* `cstring_front`: Get first character in string +* `cstring_back`: Get last character in string +* `cstring_empty`: Check if string is empty +* `cstring_starts_with_str`: Check if string starts with specified `char *` +* `cstring_ends_with_str`: Check if string ends with specified `char *` +* `cstring_starts_with_char`: Check if string starts with specified `char` +* `cstring_ends_with_char`: Check if string ends with specified `char` +* `cstring_copy`: Copy contents of a `char *` +* `cstring_resize`: Resize string +* `cstring_getline`: Read a line from a `FILE` stream +* `cstring_greater`: Check if `lhs` is greater than `rhs` +* `cstring_greater_or_equal`: True `lhs` is greater of equal to `rhs` +* `cstring_less`: Check if `lhs` is less than `rhs` +* `cstring_less_or_equal`: Check if `lhs` is less or equal to `rhs` + +`lhs`: Left hand side +`rhs`: Right hand side ## Example