Go to the source code of this file.
Functions | |
void | substr_replace (char **strp, int *strp_len, int *strp_alloc_size, const int start, const int end, const char *replace, const int replace_len) |
substring replacement. | |
void | string_escape (char **strp, int *strp_len, int *strp_alloc_size, const char *chars, int chars_len, int options) |
Escape a string by specific options. | |
void | string_unescape (char **strp, int *strp_len, int *strp_size) |
int | string_count (const char *src, const char *charlist) |
int | string_ncount (const char *src, size_t srclen, const char *charlist, size_t listlen) |
char * | string_ndup (const char *src, size_t size) |
void string_escape | ( | char ** | strp, | |
int * | strp_len, | |||
int * | strp_alloc_size, | |||
const char * | chars, | |||
int | chars_len, | |||
int | options | |||
) |
Escape a string by specific options.
This function will
strp | pointer to string to escape |
void substr_replace | ( | char ** | strp, | |
int * | strp_len, | |||
int * | strp_alloc_size, | |||
const int | start, | |||
const int | end, | |||
const char * | replace, | |||
const int | replace_len | |||
) |
substring replacement.
This function handles growing the string if the new length would be longer than the alloc size.
strp | pointer to the string you want to modify | |
strp_len | pointer to current length of the string. If negative, I will use strlen() to calculate the length myself. | |
strp_alloc_size | pointer to current allocated size of string | |
start | start position of the replacement. 0 offset. If negative, it is an offset against the end of the string; -1 for end of string. | |
end | end position of the replacement. If negative, it is an offset against the end of the string; -1 for end of string. If zero (0), then end is set to start. | |
replace | string to replace with | |
replace_len | length of the replacement string |