An assortment of functions which work with strings.
More...
Go to the source code of this file.
|
char * | strdup2 (const char *s) |
| create a copy of a string, on the heap More...
|
|
char * | strstrr (const char *haystack, const char *needle) |
| returns a pointer to the last occurrence of a substring More...
|
|
char * | strrep (const char *haystack, const char *needle, const char *replacement) |
| returns a new string with a string replaced More...
|
|
char * | concat_strs_arr (size_t n, char **strs) |
| concatenate strings together More...
|
|
char * | concat_strs (size_t n,...) |
| concatenate strings together More...
|
|
int | is_slash (char c) |
| determines if a character is a slash More...
|
|
char * | remove_prefix (char *str, size_t n) |
| remove the first n letters from a string, in place More...
|
|
char * | lower_str (char *str) |
| make a string lower case, in place More...
|
|
An assortment of functions which work with strings.
char* concat_strs |
( |
size_t |
n, |
|
|
|
... |
|
) |
| |
concatenate strings together
- Parameters
-
n | the number of strings |
... | the strings to concatenate, in order |
- Returns
- the resulting string. Free using free()
char* concat_strs_arr |
( |
size_t |
n, |
|
|
char ** |
strs |
|
) |
| |
concatenate strings together
- Parameters
-
n | the number of strings |
strs | the strings to concatenate, in order |
- Returns
- the resulting string. Free using free()
determines if a character is a slash
- Parameters
-
- Returns
- 1 if c is a slash, 0 otherwise
char* lower_str |
( |
char * |
str | ) |
|
make a string lower case, in place
- Parameters
-
str | the string. This is mutated |
n | the number of characters to remove |
- Returns
- a reference to str
char* remove_prefix |
( |
char * |
str, |
|
|
size_t |
n |
|
) |
| |
remove the first n letters from a string, in place
- Parameters
-
str | the string. This is mutated |
n | the number of characters to remove |
- Returns
- a reference to str
char* strdup2 |
( |
const char * |
s | ) |
|
create a copy of a string, on the heap
- Parameters
-
- Returns
- a copy of s. Free using free()
char* strrep |
( |
const char * |
haystack, |
|
|
const char * |
needle, |
|
|
const char * |
replacement |
|
) |
| |
returns a new string with a string replaced
- Parameters
-
haystack | the string to look through |
needle | the string to look for |
replacement | the string to replace the needle with |
- Returns
- a pointer to a string. Free using free()
char* strstrr |
( |
const char * |
haystack, |
|
|
const char * |
needle |
|
) |
| |
returns a pointer to the last occurrence of a substring
- Parameters
-
haystack | the string to look through |
needle | the string to look for |
- Returns
- a pointer to the last occurrence of needle, or NULL