|
static size_t * | coco_allocate_vector_size_t (const size_t number_of_elements) |
|
static char * | coco_allocate_string (const size_t number_of_elements) |
|
static char * | coco_strdup (const char *string) |
| Creates a duplicate copy of string and returns a pointer to it. More...
|
|
static char * | coco_vstrdupf (const char *str, va_list args) |
| Formatted string duplication, with va_list arguments. More...
|
|
char * | coco_strdupf (const char *str,...) |
| Formatted string duplication. More...
|
|
static char * | coco_strconcat (const char *s1, const char *s2) |
| Returns a concatenate copy of string1 + string2. More...
|
|
static long | coco_strfind (const char *base, const char *seq) |
| Returns the first index where seq occurs in base and -1 if it doesn't. More...
|
|
static char ** | coco_string_split (const char *string, const char delimiter) |
| Splits a string based on the given delimiter. More...
|
|
static char * | coco_remove_from_string (const char *string, const char *from, const char *to) |
| Creates and returns a string with removed characters between from and to. More...
|
|
static size_t * | coco_string_parse_ranges (const char *string, const size_t min, const size_t max, const char *name, const size_t max_count) |
| Returns the numbers defined by the ranges. More...
|
|
static char * | coco_string_trim (char *string) |
| Trims the given string (removes any leading and trailing spaces). More...
|
|
Definitions of functions that manipulate strings.
static char* coco_remove_from_string |
( |
const char * |
string, |
|
|
const char * |
from, |
|
|
const char * |
to |
|
) |
| |
|
static |
Creates and returns a string with removed characters between from and to.
If you wish to remove characters from the beginning of the string, set from to "". If you wish to remove characters until the end of the string, set to to "".
The caller is responsible for freeing the allocated memory using coco_free_memory().
static size_t* coco_string_parse_ranges |
( |
const char * |
string, |
|
|
const size_t |
min, |
|
|
const size_t |
max, |
|
|
const char * |
name, |
|
|
const size_t |
max_count |
|
) |
| |
|
static |
Returns the numbers defined by the ranges.
Reads ranges from a string of positive ranges separated by commas. For example: "-3,5-6,8-". Returns the numbers that are defined by the ranges if min and max are used as their extremes. If the ranges with open beginning/end are not allowed, use 0 as min/max. The returned string has an appended 0 to mark its end. A maximum of max_count values is returned. If there is a problem with one of the ranges, the parsing stops and the current result is returned. The memory of the returned object needs to be freed by the caller.