C Standard Library Extensions
1.2.3
|
21 #define CX_STRING_H_ 1
29 #include <cxmessages.h>
130 const cxchar *, ...) CX_GNUC_PRINTF(2, 3);
132 const cxchar *, va_list) CX_GNUC_PRINTF(2, 0);
struct _cx_string_ cx_string
The cx_string data type.
Definition: cxstring.h:52
void cx_string_extend(cx_string *self, cxsize size, cxchar c)
Extend a string to a given length.
Definition: cxstring.c:1203
cxint cx_vasprintf(cxchar **string, const cxchar *format, va_list args)
Write formatted output to a newly allocated string with a variable-length argument list.
Definition: cxutils.c:380
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.
Definition: cxstrutils.c:246
void cx_string_replace_character(cx_string *self, cxsize start, cxsize end, cxchar old_value, cxchar new_value)
Replace a given character with a new character in a portion of a string.
Definition: cxstring.c:1092
cxint cx_string_compare(const cx_string *string1, const cx_string *string2)
Compare two strings.
Definition: cxstring.c:902
cx_string * cx_string_truncate(cx_string *self, cxsize length)
Truncate the string.
Definition: cxstring.c:828
cx_string * cx_string_create(const cxchar *value)
Create a new string from a standard C string.
Definition: cxstring.c:278
cx_string * cx_string_prepend(cx_string *self, const cxchar *data)
Prepend an array of characters to the string.
Definition: cxstring.c:593
cxint cx_string_ncasecmp(const cx_string *string1, const cx_string *string2, cxsize n)
Compare the first n characters of two strings ignoring the case of characters.
Definition: cxstring.c:962
cxptr cx_malloc(cxsize nbytes)
Allocate nbytes bytes.
Definition: cxmemory.c:280
cxbool cx_string_empty(const cx_string *self)
Checks whether a string contains any characters.
Definition: cxstring.c:355
cx_string * cx_string_lower(cx_string *self)
Converts the string into lowercase.
Definition: cxstring.c:476
void cx_string_resize(cx_string *self, cxsize size, cxchar c)
Resize a string to a given length.
Definition: cxstring.c:1147
cx_string * cx_string_substr(const cx_string *self, cxsize pos, cxsize len)
Create a new string from a portion of a string.
Definition: cxstring.c:1347
cxbool cx_string_equal(const cx_string *string1, const cx_string *string2)
Compare two cx_string for equality.
Definition: cxstring.c:857
void cx_free(cxptr memory)
Memory block deallocation.
Definition: cxmemory.c:486
cx_string * cx_string_insert(cx_string *self, cxssize position, const cxchar *data)
Inserts a copy of a string at a given position.
Definition: cxstring.c:698
cx_string * cx_string_new(void)
Create a new, empty string container.
Definition: cxstring.c:232
cxptr cx_calloc(cxsize natoms, cxsize nbytes)
Allocate memory for natoms elements of size size.
Definition: cxmemory.c:380
void cx_string_print(const cx_string *string)
Print the value of a cx_string to the standard output.
Definition: cxstring.c:1058
void cx_string_set(cx_string *self, const cxchar *data)
Assign a value to a string.
Definition: cxstring.c:381
cx_string * cx_string_copy(const cx_string *self)
Create a copy a cx_string.
Definition: cxstring.c:250
void cx_print(const cxchar *format,...)
Output a formatted message via the print handler.
Definition: cxmessages.c:1280
cxsize cx_string_size(const cx_string *self)
Computes the length of the string.
Definition: cxstring.c:332
cx_string * cx_string_upper(cx_string *self)
Converts the string into uppercase.
Definition: cxstring.c:441
cxsize cx_string_find_last_not_of(const cx_string *self, const cxchar *characters)
Search a string for the last character that does not match any of the given characters.
Definition: cxstring.c:1291
cx_string * cx_string_strip(cx_string *self)
Remove leading and trailing whitespaces from the string.
Definition: cxstring.c:565
cxint cx_string_sprintf(cx_string *self, const char *format,...)
Writes to a string under format control.
Definition: cxstring.c:996
cxint cx_strcasecmp(const cxchar *s1, const cxchar *s2)
Compare two strings ignoring the case of ASCII characters.
Definition: cxstrutils.c:203
cx_string * cx_string_trim(cx_string *self)
Remove leading whitespaces from the string.
Definition: cxstring.c:511
cxint cx_string_vsprintf(cx_string *self, const cxchar *format, va_list args)
Write to the string from a variable-length argument list under format control.
Definition: cxstring.c:1036
void cx_string_delete(cx_string *self)
Destroy a string.
Definition: cxstring.c:305
cxchar * cx_strdup(const cxchar *string)
Duplicate a string.
Definition: cxstrutils.c:497
cx_string * cx_string_append(cx_string *self, const cxchar *data)
Append an array of characters to the string.
Definition: cxstring.c:645
cx_string * cx_string_rtrim(cx_string *self)
Remove trailing whitespaces from the string.
Definition: cxstring.c:538
const cxchar * cx_string_get(const cx_string *self)
Get the string's value.
Definition: cxstring.c:414
cxint cx_string_casecmp(const cx_string *string1, const cx_string *string2)
Compare two strings ignoring the case of characters.
Definition: cxstring.c:927
cx_string * cx_string_erase(cx_string *self, cxssize position, cxssize length)
Erase a portion of the string.
Definition: cxstring.c:757
cxsize cx_string_find_first_not_of(const cx_string *self, const cxchar *characters)
Search a string for the first character that does not match any of the given characters.
Definition: cxstring.c:1247