 |
 |
 |
 |
Etk_String
|
Data Structures |
struct | Etk_String |
| An Etk_String is an easy way to manipulate a string. More...
|
Defines |
#define | ETK_STRING_TYPE (etk_string_type_get()) |
| Gets the type of a string.
|
#define | ETK_STRING(obj) (ETK_OBJECT_CAST((obj), ETK_STRING_TYPE, Etk_String)) |
| Casts the object to an Etk_String.
|
#define | ETK_IS_STRING(obj) (ETK_OBJECT_CHECK_TYPE((obj), ETK_STRING_TYPE)) |
| Checks if the object is an Etk_Text_Buffer.
|
Functions |
Etk_String * | etk_string_new (const char *value) |
| Creates a new string.
|
Etk_String * | etk_string_new_sized (const char *value, int size) |
| Creates a new string, with a specific size.
|
Etk_String * | etk_string_new_printf (const char *format,...) |
| Creates a new string, and sets its default value from the format and the arguments.
|
Etk_String * | etk_string_new_vprintf (const char *format, va_list args) |
| Creates a new string, and sets its default value from the format and the arguments.
|
Etk_String * | etk_string_copy (const Etk_String *string) |
| Creates a new string and copies the text from string.
|
const char * | etk_string_get (Etk_String *string) |
| Gets the string as an array of char.
|
int | etk_string_length_get (Etk_String *string) |
| Gets the length of the string.
|
Etk_String * | etk_string_truncate (Etk_String *string, int length) |
| Truncates the string.
|
Etk_String * | etk_string_delete (Etk_String *string, int pos, int size) |
| Removes from the string a segment of size "size" from the position "pos".
|
Etk_String * | etk_string_clear (Etk_String *string) |
| Clears the string: all the allocated memory will be freed, and the length of the string will be 0.
|
Etk_String * | etk_string_set (Etk_String *string, const char *value) |
| Sets the value of a string.
|
Etk_String * | etk_string_set_sized (Etk_String *string, const char *value, int size) |
| Sets the value of a string, with a specific size.
|
Etk_String * | etk_string_set_printf (Etk_String *string, const char *format,...) |
| Sets the value of the string from the format and the arguments.
|
Etk_String * | etk_string_set_vprintf (Etk_String *string, const char *format, va_list args) |
| Sets the value of the string from the format and the arguments.
|
Etk_String * | etk_string_prepend (Etk_String *string, const char *text) |
| Prepends a text to a string.
|
Etk_String * | etk_string_prepend_sized (Etk_String *string, const char *text, int length) |
| Prepends a text with a specific length to a string.
|
Etk_String * | etk_string_prepend_char (Etk_String *string, char c) |
| Prepends a character to a string.
|
Etk_String * | etk_string_prepend_printf (Etk_String *string, const char *format,...) |
| Prepends a text to a string from the format and the arguments.
|
Etk_String * | etk_string_prepend_vprintf (Etk_String *string, const char *format, va_list args) |
| Prepends a text to a string from the format and the arguments.
|
Etk_String * | etk_string_append (Etk_String *string, const char *text) |
| Appends a text to a string.
|
Etk_String * | etk_string_append_sized (Etk_String *string, const char *text, int length) |
| Appends a text with a specific length to a string.
|
Etk_String * | etk_string_append_char (Etk_String *string, char c) |
| Appends a character to a string.
|
Etk_String * | etk_string_append_printf (Etk_String *string, const char *format,...) |
| Appends a text to a string from the format and the arguments.
|
Etk_String * | etk_string_append_vprintf (Etk_String *string, const char *format, va_list args) |
| Appends a text to a string from the format and the arguments.
|
Etk_String * | etk_string_insert (Etk_String *string, int pos, const char *text) |
| Inserts a text into a string.
|
Etk_String * | etk_string_insert_sized (Etk_String *string, int pos, const char *text, int length) |
| Inserts a text with a specific length into a string.
|
Etk_String * | etk_string_insert_char (Etk_String *string, int pos, char c) |
| Inserts a character into a string.
|
Etk_String * | etk_string_insert_printf (Etk_String *string, int pos, const char *format,...) |
| Inserts a text into a string from the format and the arguments.
|
Etk_String * | etk_string_insert_vprintf (Etk_String *string, int pos, const char *format, va_list args) |
| Inserts a text into a string from the format and the arguments.
|
Define Documentation
#define ETK_STRING_TYPE (etk_string_type_get()) |
Gets the type of a string.
#define ETK_STRING |
( |
obj |
|
) |
(ETK_OBJECT_CAST((obj), ETK_STRING_TYPE, Etk_String)) |
#define ETK_IS_STRING |
( |
obj |
|
) |
(ETK_OBJECT_CHECK_TYPE((obj), ETK_STRING_TYPE)) |
Checks if the object is an Etk_Text_Buffer.
Function Documentation
Etk_String * etk_string_new |
( |
const char * |
value |
) |
|
Creates a new string.
- Parameters:
-
| value | the default value of the string. Can be NULL |
- Returns:
- Returns the new string
Etk_String * etk_string_new_sized |
( |
const char * |
value, |
|
|
int |
size | |
|
) |
| | |
Creates a new string, with a specific size.
- Parameters:
-
| value | the default value of the string. Can be NULL |
| size | If size is lower than the length of value, the string will be truncated.
Otherwise, extra memory will be allocated (useful if you planned to insert text often and want to avoid too many reallocations) |
- Returns:
- Returns the new string
Etk_String * etk_string_new_printf |
( |
const char * |
format, |
|
|
|
... | |
|
) |
| | |
Creates a new string, and sets its default value from the format and the arguments.
- Parameters:
-
| format | the format to set to the string. It uses the same arguments than printf() |
| ... | the arguments corresponding to the format |
- Returns:
- Returns the new string
Etk_String * etk_string_new_vprintf |
( |
const char * |
format, |
|
|
va_list |
args | |
|
) |
| | |
Creates a new string, and sets its default value from the format and the arguments.
- Parameters:
-
| format | the format to set to the string. It uses the same arguments than printf() |
| args | the arguments corresponding to the format |
- Returns:
- Returns the new string
Creates a new string and copies the text from string.
- Parameters:
-
| string | the string to copy |
- Returns:
- Returns the new copied string
const char * etk_string_get |
( |
Etk_String * |
string |
) |
|
Gets the string as an array of char.
- Parameters:
-
| string | a string |
| Returns | the string as an array of char (a pointer on the first character) |
Gets the length of the string.
- Parameters:
-
- Returns:
- Returns the length of the string
Truncates the string.
- Parameters:
-
| string | a string |
| length | the new length of the string. If length is greater than the current length of the string, the function does nothing |
- Returns:
- Returns the truncated string
Removes from the string a segment of size "size" from the position "pos".
- Parameters:
-
| string | a string |
| pos | the position where to start the deletion |
| size | the size of the segment of text to remove |
- Returns:
- Returns the string
Clears the string: all the allocated memory will be freed, and the length of the string will be 0.
- Parameters:
-
| string | the string to clear |
- Returns:
- Returns the string
Sets the value of a string.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| value | the value to assign to the string |
- Returns:
- Returns the string
Sets the value of a string, with a specific size.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| value | the value to assign to the string |
| size | If size is lower than the length of value, the string will be truncated.
Otherwise, extra memory will be allocated (useful if you planned to insert text often and want to avoid too many reallocations) |
- Returns:
- Returns the string
Sets the value of the string from the format and the arguments.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| format | the format to set to the string. It uses the same arguments than printf() |
| ... | the arguments corresponding to the format |
- Returns:
- Returns the string
Sets the value of the string from the format and the arguments.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| format | the format to set to the string. It uses the same arguments than printf() |
| args | the arguments corresponding to the format |
- Returns:
- Returns the string
Prepends a text to a string.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| text | the text to prepend to the string |
- Returns:
- Returns the string
Prepends a text with a specific length to a string.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| text | the text to prepend to the string |
| length | the length of the text to prepend |
- Returns:
- Returns the string
Prepends a character to a string.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| c | the character to prepend to the string |
- Returns:
- Returns the string
Prepends a text to a string from the format and the arguments.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| format | the format to prepend to the string. It uses the same arguments than printf() |
| ... | the arguments corresponding to the format |
- Returns:
- Returns the string
Prepends a text to a string from the format and the arguments.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| format | the format to prepend to the string. It uses the same arguments than printf() |
| args | the arguments corresponding to the format |
- Returns:
- Returns the string
Appends a text to a string.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| text | the text to append to the string |
- Returns:
- Returns the string
Appends a text with a specific length to a string.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| text | the text to append to the string |
| length | the length of the text to append |
- Returns:
- Returns the string
Appends a character to a string.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| c | the character to append to the string |
- Returns:
- Returns the string
Appends a text to a string from the format and the arguments.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| format | the format to append to the string. It uses the same arguments than printf() |
| ... | the arguments corresponding to the format |
- Returns:
- Returns the string
Appends a text to a string from the format and the arguments.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| format | the format to append to the string. It uses the same arguments than printf() |
| args | the arguments corresponding to the format |
- Returns:
- Returns the string
Inserts a text into a string.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| pos | the position where to insert the text |
| text | the text to insert into the string |
- Returns:
- Returns the string
Etk_String * etk_string_insert_sized |
( |
Etk_String * |
string, |
|
|
int |
pos, |
|
|
const char * |
text, |
|
|
int |
length | |
|
) |
| | |
Inserts a text with a specific length into a string.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| pos | the position where to insert the text |
| text | the text to insert into the string |
| length | the length of the text to insert |
- Returns:
- Returns the string
Inserts a character into a string.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| pos | the positon where to insert the char |
| c | the character to insert into the string |
- Returns:
- Returns the string
Inserts a text into a string from the format and the arguments.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| pos | the positon where to insert the char |
| format | the format to insert into the string. It uses the same arguments than printf() |
| ... | the arguments corresponding to the format |
- Returns:
- Returns the string
Etk_String * etk_string_insert_vprintf |
( |
Etk_String * |
string, |
|
|
int |
pos, |
|
|
const char * |
format, |
|
|
va_list |
args | |
|
) |
| | |
Inserts a text into a string from the format and the arguments.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| pos | the positon where to insert the char |
| format | the format to insert into the string. It uses the same arguments than printf() |
| args | the arguments corresponding to the format |
- Returns:
- Returns the string
|
 |
 |
 |
 |
|