Typedefs | |
typedef _cx_string_ | cx_string |
The cx_string data type. | |
Functions | |
cx_string * | cx_string_new (void) |
Create a new, initialized string container. | |
cx_string * | cx_string_copy (const cx_string *self) |
Create a copy a cx_string. | |
cx_string * | cx_string_create (const cxchar *value) |
Create a new string from a standard C string. | |
void | cx_string_delete (cx_string *self) |
Destroy a string. | |
cxsize | cx_string_size (const cx_string *self) |
Computes the length of the string. | |
cxbool | cx_string_empty (const cx_string *self) |
Checks whether a string contains any characters. | |
void | cx_string_set (cx_string *self, const cxchar *data) |
Assign a value to a string. | |
const cxchar * | cx_string_get (const cx_string *self) |
Get the string's value. | |
cx_string * | cx_string_upper (cx_string *self) |
Converts the string into uppercase. | |
cx_string * | cx_string_lower (cx_string *self) |
Converts the string into lowercase. | |
cx_string * | cx_string_trim (cx_string *self) |
Remove leading whitespaces from the string. | |
cx_string * | cx_string_rtrim (cx_string *self) |
Remove trailing whitespaces from the string. | |
cx_string * | cx_string_strip (cx_string *self) |
Remove leading and trailing whitespaces from the string. | |
cx_string * | cx_string_prepend (cx_string *self, const cxchar *data) |
Prepend an array of characters to the string. | |
cx_string * | cx_string_append (cx_string *self, const cxchar *data) |
Append an array of characters to the string. | |
cx_string * | cx_string_insert (cx_string *self, cxssize position, const cxchar *data) |
Inserts a copy of a string at a given position. | |
cx_string * | cx_string_erase (cx_string *self, cxssize position, cxssize length) |
Erase a portion of the string. | |
cx_string * | cx_string_truncate (cx_string *self, cxsize length) |
Truncate the string. | |
cxbool | cx_string_equal (const cx_string *string1, const cx_string *string2) |
Compare two cx_string for equality. | |
cxint | cx_string_compare (const cx_string *string1, const cx_string *string2) |
Compare two strings. | |
cxint | cx_string_casecmp (const cx_string *string1, const cx_string *string2) |
Compare two strings ignoring the case of characters. | |
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. | |
cxint | cx_string_sprintf (cx_string *self, const char *format,...) |
Writes to a string under format control. | |
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. | |
void | cx_string_print (const cx_string *string) |
Print the value of a cx_string to the standard output. |
Append an array of characters to the string.
self | The string. | |
data | Pointer to character array to be appended. |
NULL
in case of errors.NULL
pointer the string self is not modified.
Compare two strings ignoring the case of characters.
string1 | First cx_string. | |
string2 | Second cx_string. |
0
if string1 is found, respectively, to be less than, to match, or to be greater than string2.Compare two strings.
string1 | First cx_string. | |
string2 | Second cx_string. |
0
if string1 is found, respectively, to be less than, to match, or to be greater than string2.Create a copy a cx_string.
self | The string to copy. |
cx_string* cx_string_create | ( | const cxchar * | value | ) |
Create a new string from a standard C string.
value | The initial text to copy into the string. |
void cx_string_delete | ( | cx_string * | self | ) |
Destroy a string.
self | The string to destroy. |
cxbool cx_string_empty | ( | const cx_string * | self | ) |
Checks whether a string contains any characters.
self | The string. |
Compare two cx_string for equality.
string1 | First cx_string. | |
string2 | Second cx_string. |
Erase a portion of the string.
self | The string. | |
position | Position of the first character to be erased. | |
length | Number of characters to erase. |
NULL
in case of errors.
If the number of characters to erase length is less the 0
all characters starting at position up to the end of the string are erased.
const cxchar* cx_string_get | ( | const cx_string * | self | ) |
Get the string's value.
self | The string. |
NULL
if the string is uninitialized.
Inserts a copy of a string at a given position.
self | The string. | |
position | Character position at which the data is inserted. | |
data | Pointer to character array to be inserted. |
NULL
in case of errors.NULL
pointer the string self is not modified.
Converts the string into lowercase.
self | The string. |
NULL
in case of errors.Compare the first n characters of two strings ignoring the case of characters.
string1 | First string. | |
string2 | Second string. | |
n | Number of characters to compare. |
cx_string* cx_string_new | ( | void | ) |
Create a new, initialized string container.
Using this constructor is the only way to correctly create and setup a new string.
Prepend an array of characters to the string.
self | The string. | |
data | Pointer to character array to be prepended. |
NULL
in case of errors.NULL
pointer the string self is not modified.
void cx_string_print | ( | const cx_string * | string | ) |
Print the value of a cx_string to the standard output.
string | A cx_string. |
Remove trailing whitespaces from the string.
self | The string. |
NULL
in case of errors.void cx_string_set | ( | cx_string * | self, | |
const cxchar * | data | |||
) |
Assign a value to a string.
self | The string. | |
data | Character array to be assigned. |
cxsize cx_string_size | ( | const cx_string * | self | ) |
Computes the length of the string.
self | The string. |
cxint cx_string_sprintf | ( | cx_string * | self, | |
const char * | format, | |||
... | ||||
) |
Writes to a string under format control.
self | The string to write to. | |
format | The format string. | |
... | The arguments to insert into format. |
Remove leading and trailing whitespaces from the string.
self | The string. |
NULL
in case of errors.Remove leading whitespaces from the string.
self | The string. |
NULL
in case of errors.Truncate the string.
self | The string. | |
length | The length to which the string is truncated. |
NULL
in case of errors.Calling the truncate method is equivalent to:
cx_string *s; cx_string_erase(s, length, -1);
Converts the string into uppercase.
self | The string. |
NULL
in case of errors.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.
self | The string. | |
format | The format string. | |
args | Variable-length arguments to be inserted into format. |