Functions | |
cxint | cx_strcasecmp (const cxchar *s1, const cxchar *s2) |
Compare two strings ignoring the case of ASCII characters. | |
cxint | cx_strncasecmp (const cxchar *s1, const cxchar *s2, cxsize n) |
Compare the first n characters of two strings ignoring the case of ASCII characters. | |
cxint | cx_strempty (const cxchar *string, const cxchar *pattern) |
Test if a string represents an empty string. | |
cxchar * | cx_strlower (cxchar *s) |
Convert all uppercase characters in a string into lowercase characters. | |
cxchar * | cx_strupper (cxchar *s) |
Convert all lowercase characters in a string into uppercase characters. | |
cxchar * | cx_strtrim (cxchar *string) |
Remove leading whitespace characters from a string. | |
cxchar * | cx_strrtrim (cxchar *string) |
Remove trailing whitespace characters from a string. | |
cxchar * | cx_strstrip (cxchar *string) |
Remove leading and trailing whitespace characters from a string. | |
cxchar * | cx_strskip (const cxchar *string, int(*ctype)(int)) |
Locate the first character in a string that does not belong to a given character class. | |
cxchar * | cx_strdup (const cxchar *string) |
Duplicate a string. | |
cxchar * | cx_strndup (const cxchar *string, cxsize n) |
Duplicate the first n charactes of a string. | |
cxchar * | cx_strvdupf (const cxchar *format, va_list args) |
Create a string from a variable-length argument list under format control. | |
cxchar * | cx_stpcpy (cxchar *dest, const cxchar *src) |
Copy a string returning a pointer to its end. | |
void | cx_strfreev (cxchar **sarray) |
Deallocate a NULL terminated string array. | |
cxchar ** | cx_strsplit (const cxchar *string, const cxchar *delimiter, cxint max_tokens) |
Split a string into pieces at a given delimiter. | |
cxchar * | cx_strjoinv (const cxchar *separator, cxchar **sarray) |
Join strings from an array of strings. |
#include <cxstrutils.h>
cxchar* cx_stpcpy | ( | cxchar * | dest, | |
const cxchar * | src | |||
) |
Copy a string returning a pointer to its end.
dest | Destination string. | |
src | Source string. |
cxint cx_strcasecmp | ( | const cxchar * | s1, | |
const cxchar * | s2 | |||
) |
Compare two strings ignoring the case of ASCII characters.
s1 | First string. | |
s2 | Second string. |
cxchar* cx_strdup | ( | const cxchar * | string | ) |
Duplicate a string.
string | String to be duplicated. |
cxint cx_strempty | ( | const cxchar * | string, | |
const cxchar * | pattern | |||
) |
Test if a string represents an empty string.
string | String to be tested. | |
pattern | String containing all allowed comment characters. |
If pattern is set to NULL
there is no checking for special characters that should be considered as whitespaces.
void cx_strfreev | ( | cxchar ** | sarray | ) |
Deallocate a NULL
terminated string array.
sarray | String array to deallocate |
cxchar* cx_strjoinv | ( | const cxchar * | separator, | |
cxchar ** | sarray | |||
) |
Join strings from an array of strings.
separator | Optional separator string. | |
sarray | Array of strings to join. |
NULL
in case of error.NULL
terminated. Optionally, a separator string can be passed through separator which will then be inserted between two strings. If no separator should be inserted when joining, separator must be set to NULL
.
cxchar* cx_strlower | ( | cxchar * | s | ) |
Convert all uppercase characters in a string into lowercase characters.
s | The string to convert. |
cxint cx_strncasecmp | ( | const cxchar * | s1, | |
const cxchar * | s2, | |||
cxsize | n | |||
) |
Compare the first n characters of two strings ignoring the case of ASCII characters.
s1 | First string. | |
s2 | Second string. | |
n | Number of characters to compare. |
cxchar* cx_strndup | ( | const cxchar * | string, | |
cxsize | n | |||
) |
Duplicate the first n charactes of a string.
string | Source string | |
n | Maximum number of characters to be duplicated. |
cxchar* cx_strrtrim | ( | cxchar * | string | ) |
Remove trailing whitespace characters from a string.
string | String to be processed. |
NULL
.cxchar* cx_strskip | ( | const cxchar * | string, | |
int(*)(int) | ctype | |||
) |
Locate the first character in a string that does not belong to a given character class.
string | String to be processed. | |
ctype | Character class test function. |
cxchar** cx_strsplit | ( | const cxchar * | string, | |
const cxchar * | delimiter, | |||
cxint | max_tokens | |||
) |
Split a string into pieces at a given delimiter.
string | The string to split. | |
delimiter | String specifying the locations where to split. | |
max_tokens | The maximum number of tokens the string is split into. |
NULL
terminated array of strings, or NULL
in case of an error.The delimiter string delimiter never shows up in any of the resulting strings, unless max_tokens is reached.
As a special case, the result of splitting the empty string "" is an empty vector, not a vector containing a single string.
The created result vector can be deallocated using cx_strfreev().
cxchar* cx_strstrip | ( | cxchar * | string | ) |
Remove leading and trailing whitespace characters from a string.
NULL
.string | String to be processed. |
cxchar* cx_strtrim | ( | cxchar * | string | ) |
Remove leading whitespace characters from a string.
string | String to be processed. |
NULL
.cxchar* cx_strupper | ( | cxchar * | s | ) |
Convert all lowercase characters in a string into uppercase characters.
s | The string to convert. |
cxchar* cx_strvdupf | ( | const cxchar * | format, | |
va_list | args | |||
) |
Create a string from a variable-length argument list under format control.
format | The format string. | |
args | Variable-length arguments to be inserted into format. |