Ecore_Str.h File Reference
Contains useful C string functions. More...
Functions | |
EAPI size_t | ecore_strlcpy (char *dst, const char *src, size_t siz) |
copy a c-string | |
EAPI size_t | ecore_strlcat (char *dst, const char *src, size_t siz) |
append a c-string | |
EAPI int | ecore_str_has_prefix (const char *str, const char *prefix) |
checks if the string has the given prefix | |
EAPI int | ecore_str_has_suffix (const char *str, const char *suffix) |
checks if the string has the given suffix | |
EAPI char ** | ecore_str_split (const char *string, const char *delimiter, int max_tokens) |
Splits a string into a maximum of max_tokens pieces, using the given delimiter. |
Detailed Description
Contains useful C string functions.
Function Documentation
EAPI int ecore_str_has_prefix | ( | const char * | str, | |
const char * | prefix | |||
) |
checks if the string has the given prefix
- Parameters:
-
str the string to work with prefix the prefix to check for
- Returns:
- true if str has the given prefix
EAPI int ecore_str_has_suffix | ( | const char * | str, | |
const char * | suffix | |||
) |
checks if the string has the given suffix
- Parameters:
-
str the string to work with suffix the suffix to check for
- Returns:
- true if str has the given suffix
EAPI char** ecore_str_split | ( | const char * | str, | |
const char * | delim, | |||
int | max_tokens | |||
) |
Splits a string into a maximum of max_tokens pieces, using the given delimiter.
If max_tokens is reached, the final string in the returned string array contains the remainder of string.
- Parameters:
-
str A string to split. delim A string which specifies the places at which to split the string. The delimiter is not included in any of the resulting strings, unless max_tokens is reached. max_tokens The maximum number of strings to split string into. If this is less than 1, the string is split completely.
- Returns:
- A newly-allocated NULL-terminated array of strings. To free it: free the first element of the array and the array itself.
EAPI size_t ecore_strlcat | ( | char * | dst, | |
const char * | src, | |||
size_t | siz | |||
) |
append a c-string
- Parameters:
-
dst the destination src the source siz the size of the destination
- Returns:
- the length of the source string plus MIN(siz, strlen(initial dst)) Appends src to string dst of size siz (unlike strncat, siz is the full size of dst, not space left). At most siz-1 characters will be copied. Always NUL terminates (unless siz <= strlen(dst)). Returns strlen(src) + MIN(siz, strlen(initial dst)). If retval >= siz, truncation occurred.
EAPI size_t ecore_strlcpy | ( | char * | dst, | |
const char * | src, | |||
size_t | siz | |||
) |
copy a c-string
- Parameters:
-
dst the destination src the source siz the size of the destination
- Returns:
- the length of the source string Copy src to string dst of size siz. At most siz-1 characters will be copied. Always NUL terminates (unless siz == 0). Returns strlen(src); if retval >= siz, truncation occurred.