LICK
 All Data Structures Files Functions Variables Enumerations Enumerator
Functions
string-utils.h File Reference

An assortment of functions which work with strings. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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...
 

Detailed Description

An assortment of functions which work with strings.

Function Documentation

char* concat_strs ( size_t  n,
  ... 
)

concatenate strings together

Parameters
nthe 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
nthe number of strings
strsthe strings to concatenate, in order
Returns
the resulting string. Free using free()
int is_slash ( char  c)

determines if a character is a slash

Parameters
cthe character to check
Returns
1 if c is a slash, 0 otherwise
char* lower_str ( char *  str)

make a string lower case, in place

Parameters
strthe string. This is mutated
nthe 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
strthe string. This is mutated
nthe 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
sthe string to copy
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
haystackthe string to look through
needlethe string to look for
replacementthe 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
haystackthe string to look through
needlethe string to look for
Returns
a pointer to the last occurrence of needle, or NULL