Tizen Native API  7.0

These functions provide string buffer management.

The String Buffer data type is designed to be a mutable string, allowing the appending, prepending or insertion of a string to a buffer.

For more information see this example.

Functions

Eina_Strbufeina_strbuf_new (void)
 Creates a new string buffer.
Eina_Strbufeina_strbuf_manage_new (char *str)
 Creates a new string buffer using the passed string.
Eina_Strbufeina_strbuf_manage_new_length (char *str, size_t length)
 Creates a new string buffer using the passed string.
Eina_Strbufeina_strbuf_manage_read_only_new_length (const char *str, size_t length)
 Creates a new string buffer using the passed string.
void eina_strbuf_free (Eina_Strbuf *buf)
 Frees a string buffer.
void eina_strbuf_reset (Eina_Strbuf *buf)
 Resets a string buffer.
Eina_Bool eina_strbuf_append (Eina_Strbuf *buf, const char *str)
 Appends a string to a buffer, reallocating as necessary.
Eina_Bool eina_strbuf_append_escaped (Eina_Strbuf *buf, const char *str)
 Appends an escaped string to a buffer, reallocating as necessary.
Eina_Bool eina_strbuf_append_n (Eina_Strbuf *buf, const char *str, size_t maxlen)
 Appends a string to a buffer, reallocating as necessary, limited by the given length.
Eina_Bool eina_strbuf_append_length (Eina_Strbuf *buf, const char *str, size_t length)
 Appends a string of exact length to a buffer, reallocating as necessary.
Eina_Bool eina_strbuf_append_slice (Eina_Strbuf *buf, const Eina_Slice slice)
 Append a slice to a buffer, reallocating as necessary.
Eina_Bool eina_strbuf_append_buffer (Eina_Strbuf *buf, const Eina_Strbuf *data)
 Appends an Eina_Strbuf to a buffer, reallocating as necessary.
Eina_Bool eina_strbuf_append_char (Eina_Strbuf *buf, char c)
 Appends a character to a string buffer, reallocating as necessary.
Eina_Bool eina_strbuf_append_printf (Eina_Strbuf *buf, const char *fmt,...)
 Appends data elements to a buffer using printf-style formatting.
Eina_Bool eina_strbuf_append_vprintf (Eina_Strbuf *buf, const char *fmt, va_list args)
 Appends data elements to a string buffer using a va_list.
Eina_Bool eina_strbuf_insert (Eina_Strbuf *buf, const char *str, size_t pos)
 Inserts a string into a buffer, reallocating as necessary.
Eina_Bool eina_strbuf_insert_escaped (Eina_Strbuf *buf, const char *str, size_t pos)
 Inserts an escaped string into a buffer, reallocating as necessary.
Eina_Bool eina_strbuf_insert_n (Eina_Strbuf *buf, const char *str, size_t maxlen, size_t pos)
 Inserts a string of a maximum length into a buffer, reallocating as necessary.
Eina_Bool eina_strbuf_insert_length (Eina_Strbuf *buf, const char *str, size_t length, size_t pos)
 Inserts a string of an exact length into a buffer, reallocating as necessary.
Eina_Bool eina_strbuf_insert_slice (Eina_Strbuf *buf, const Eina_Slice slice, size_t pos)
 Insert a slice into a buffer, reallocating as necessary.
Eina_Bool eina_strbuf_insert_char (Eina_Strbuf *buf, char c, size_t pos)
 Inserts a character into a string buffer, reallocating as necessary.
Eina_Bool eina_strbuf_insert_printf (Eina_Strbuf *buf, const char *fmt, size_t pos,...)
 Inserts data elements into a buffer using printf-style formatting.
Eina_Bool eina_strbuf_insert_vprintf (Eina_Strbuf *buf, const char *fmt, size_t pos, va_list args)
 Inserts data elements into a buffer using a va_list.
Eina_Bool eina_strbuf_remove (Eina_Strbuf *buf, size_t start, size_t end)
 Removes a section from the given string buffer.
const char * eina_strbuf_string_get (const Eina_Strbuf *buf)
 Retrieves a pointer to the contents of a string buffer.
char * eina_strbuf_string_steal (Eina_Strbuf *buf)
 Steals the contents of a string buffer.
void eina_strbuf_string_free (Eina_Strbuf *buf)
 Frees the contents of a string buffer but not the buffer.
size_t eina_strbuf_length_get (const Eina_Strbuf *buf)
 Retrieves the length of the string buffer's content.
Eina_Bool eina_strbuf_replace (Eina_Strbuf *buf, const char *str, const char *with, unsigned int n)
 Replaces a substring in the buffer with another string.
Eina_Bool eina_strbuf_replace_last (Eina_Strbuf *buf, const char *str, const char *with)
 Replaces the last occurrence of a substring with another string.
int eina_strbuf_replace_all (Eina_Strbuf *buf, const char *str, const char *with)
 Replaces all matching substrings with another string.
void eina_strbuf_trim (Eina_Strbuf *buf)
 Trims the string buffer.
void eina_strbuf_ltrim (Eina_Strbuf *buf)
 Left trims the string buffer.
void eina_strbuf_rtrim (Eina_Strbuf *buf)
 Right trims the string buffer.
void eina_strbuf_tolower (Eina_Strbuf *buf)
 Converts the string to lower case.
Eina_Slice eina_strbuf_slice_get (const Eina_Strbuf *buf)
 Gets a read-only slice of the buffer contents.
Eina_Rw_Slice eina_strbuf_rw_slice_get (const Eina_Strbuf *buf)
 Gets a read-write slice of the buffer contents.
char * eina_strbuf_release (Eina_Strbuf *buf)
 Frees the buffer, returning its old contents.

Typedefs

typedef struct _Eina_Strbuf Eina_Strbuf

Defines

#define eina_strbuf_prepend(buf, str)   eina_strbuf_insert(buf, str, 0)
 Prepends a string to the given buffer.
#define eina_strbuf_prepend_escaped(buf, str)   eina_strbuf_insert_escaped(buf, str, 0)
 Prepends an escaped string to the given buffer.
#define eina_strbuf_prepend_n(buf, str, maxlen)   eina_strbuf_insert_n(buf, str, maxlen, 0)
 Prepends an escaped string to the given buffer.
#define eina_strbuf_prepend_length(buf, str, length)   eina_strbuf_insert_length(buf, str, length, 0)
 Prepends an escaped string to the given buffer.
#define eina_strbuf_prepend_char(buf, c)   eina_strbuf_insert_char(buf, c, 0)
 Prepends a character to the given buffer.
#define eina_strbuf_prepend_printf(buf, fmt,...)   eina_strbuf_insert_printf(buf, fmt, 0, ## __VA_ARGS__)
 Prepends data elements to the given buffer using printf-style formatting.
#define eina_strbuf_prepend_vprintf(buf, fmt, args)   eina_strbuf_insert_vprintf(buf, fmt, 0, args)
 Prepends the given string to the given buffer.
#define eina_strbuf_replace_first(buf, str, with)   eina_strbuf_replace(buf, str, with, 1)
 Replaces the first occurrence of a substring with another string.
#define eina_strbuf_prepend_strftime(buf, fmt, tm)   eina_strbuf_insert_strftime(buf, fmt, tm, 0)
 Prepends a strftime-style timestamp to the buffer.

Define Documentation

#define eina_strbuf_prepend (   buf,
  str 
)    eina_strbuf_insert(buf, str, 0)

Prepends a string to the given buffer.

Parameters:
[in,out]bufThe string buffer.
[in]strThe string to prepend.
Returns:
EINA_TRUE on success, EINA_FALSE if str could not be prepended.

This macro simply calls eina_strbuf_insert() with position 0.

#define eina_strbuf_prepend_char (   buf,
 
)    eina_strbuf_insert_char(buf, c, 0)

Prepends a character to the given buffer.

Parameters:
[in,out]bufThe string buffer.
[in]cThe character to prepend.
Returns:
EINA_TRUE on success, EINA_FALSE on failure.

This macro simply calls eina_strbuf_insert_char() with position 0.

#define eina_strbuf_prepend_escaped (   buf,
  str 
)    eina_strbuf_insert_escaped(buf, str, 0)

Prepends an escaped string to the given buffer.

Parameters:
[in,out]bufThe string buffer.
[in]strThe string to prepend.
Returns:
EINA_TRUE on success, EINA_FALSE if str could not be prepended.

This macro simply calls eina_strbuf_insert_escaped() with position 0.

#define eina_strbuf_prepend_length (   buf,
  str,
  length 
)    eina_strbuf_insert_length(buf, str, length, 0)

Prepends an escaped string to the given buffer.

Parameters:
[in,out]bufThe string buffer.
[in]strThe string to prepend.
[in]lengthThe exact length to use.
Returns:
EINA_TRUE on success, EINA_FALSE if str could not be prepended.

This macro simply calls eina_strbuf_insert_length() with position 0.

#define eina_strbuf_prepend_n (   buf,
  str,
  maxlen 
)    eina_strbuf_insert_n(buf, str, maxlen, 0)

Prepends an escaped string to the given buffer.

Parameters:
[in,out]bufThe string buffer.
[in]strThe string to prepend.
[in]maxlenThe maximum number of chars to prepend.
Returns:
EINA_TRUE on success, EINA_FALSE if str could not be prepended.

This macro simply calls eina_strbuf_insert_n() with position 0.

#define eina_strbuf_prepend_printf (   buf,
  fmt,
  ... 
)    eina_strbuf_insert_printf(buf, fmt, 0, ## __VA_ARGS__)

Prepends data elements to the given buffer using printf-style formatting.

Parameters:
[in,out]bufThe string buffer.
[in]fmtThe string to prepend.
[in]...Variable list of data elements to prepend.
Returns:
EINA_TRUE on success, EINA_FALSE if data could not be prepended.

This macro simply calls eina_strbuf_insert_printf() with position 0.

#define eina_strbuf_prepend_strftime (   buf,
  fmt,
  tm 
)    eina_strbuf_insert_strftime(buf, fmt, tm, 0)

Prepends a strftime-style timestamp to the buffer.

Parameters:
[in,out]bufThe string buffer.
[in]fmtThe formatting string.
[in]tmThe time value.
Returns:
EINA_TRUE on success, EINA_FALSE if tm could not be prepended.

This macro simply calls eina_strbuf_insert_strftime() with position 0.

Since (EFL) :
1.21
#define eina_strbuf_prepend_vprintf (   buf,
  fmt,
  args 
)    eina_strbuf_insert_vprintf(buf, fmt, 0, args)

Prepends the given string to the given buffer.

Parameters:
[in,out]bufThe string buffer.
[in]fmtThe string to prepend.
[in]argsThe variable arguments.
Returns:
EINA_TRUE on success, EINA_FALSE if data could not be prepended.

This macro simply calls eina_strbuf_insert_vprintf() with position 0.

#define eina_strbuf_replace_first (   buf,
  str,
  with 
)    eina_strbuf_replace(buf, str, with, 1)

Replaces the first occurrence of a substring with another string.

Parameters:
[in,out]bufThe string buffer.
[in]strThe text to match.
[in]withThe replacement string.
Returns:
EINA_TRUE on success, EINA_FALSE if str could not be replaced in buf.

This macro simply calls eina_strbuf_replace() with n equal to 1.

Examples:
entry_example.c.

Typedef Documentation

Type for a string buffer.


Function Documentation

Eina_Bool eina_strbuf_append ( Eina_Strbuf buf,
const char *  str 
)

Appends a string to a buffer, reallocating as necessary.

Parameters:
[in,out]bufThe string buffer.
[in]strThe string to append.
Returns:
EINA_TRUE on success, EINA_FALSE on failure such as if str could not be appended.

This function appends str to buf. It computes the length of str, so is slightly slower than eina_strbuf_append_length(). If the length is known beforehand, consider using that variant.

See also:
eina_strbuf_append()
eina_strbuf_append_length()
Since :
2.3
Examples:
entry_example.c.

Appends an Eina_Strbuf to a buffer, reallocating as necessary.

Parameters:
[in,out]bufThe string buffer.
[in]dataThe string buffer to append.
Returns:
EINA_TRUE on success, EINA_FALSE if data could not be appended.

This function appends data to buf. data must be allocated and different from NULL. It is slightly faster than eina_strbuf_append() as it does not compute the size of str.

See also:
eina_strbuf_append()
eina_strbuf_append_n()
eina_strbuf_append_length()
Since (EFL) :
1.9.0
Since :
3.0

Appends a character to a string buffer, reallocating as necessary.

Parameters:
[in,out]bufThe string buffer.
[in]cThe character to append.
Returns:
EINA_TRUE on success, EINA_FALSE if c could not be appended.

This function appends c to buf.

Since :
2.3
Examples:
eina_strbuf_01.c.
Eina_Bool eina_strbuf_append_escaped ( Eina_Strbuf buf,
const char *  str 
)

Appends an escaped string to a buffer, reallocating as necessary.

Parameters:
[in,out]bufThe string buffer.
[in]strThe string to append.
Returns:
EINA_TRUE on success, EINA_FALSE if str could not be appended.

This function escapes and then appends the string str to buf.

Since :
2.3
Examples:
eina_strbuf_01.c.
Eina_Bool eina_strbuf_append_length ( Eina_Strbuf buf,
const char *  str,
size_t  length 
)

Appends a string of exact length to a buffer, reallocating as necessary.

Parameters:
[in,out]bufThe string buffer.
[in]strThe string to append.
[in]lengthThe exact length to use.
Returns:
EINA_TRUE on success, EINA_FALSE if str could not be appended.

This function appends str to buf. str must be of size at most length. It is slightly faster than eina_strbuf_append() as it does not compute the size of str. It is useful when dealing with strings of known size, such as eina_stringshare.

See also:
eina_stringshare_length()
eina_strbuf_append()
eina_strbuf_append_n()
Since :
2.3
Examples:
eina_strbuf_01.c.
Eina_Bool eina_strbuf_append_n ( Eina_Strbuf buf,
const char *  str,
size_t  maxlen 
)

Appends a string to a buffer, reallocating as necessary, limited by the given length.

Parameters:
[in,out]bufThe string buffer.
[in]strThe string to append.
[in]maxlenThe maximum number of characters to append.
Returns:
EINA_TRUE on success, EINA_FALSE if str could not be appended.

This function appends at most maxlen characters of str to buf. It can't append more than the length of str. It computes the length of str, so it is slightly slower than eina_strbuf_append_length(). If the length is known beforehand, consider using that variant (maxlen should then be checked so that it is greater than the size of str).

See also:
eina_strbuf_append()
eina_strbuf_append_length()
Since :
2.3
Eina_Bool eina_strbuf_append_printf ( Eina_Strbuf buf,
const char *  fmt,
  ... 
)

Appends data elements to a buffer using printf-style formatting.

Parameters:
[in,out]bufThe string buffer.
[in]fmtA formatting string.
[in]...Variable list of data parameters to be appended.
Returns:
EINA_TRUE on success, EINA_FALSE if formatted string could not be appended.

This function appends the string defined by the format fmt to buf, reallocating as necessary. fmt must be of a valid format for the printf family of functions.

See also:
eina_strbuf_append()
Since :
2.3
Examples:
eina_strbuf_01.c.

Append a slice to a buffer, reallocating as necessary.

Parameters:
[in,out]bufThe string buffer.
[in]sliceThe slice to append.
Returns:
EINA_TRUE on success, EINA_FALSE if slice could not be appended.

This function appends slice to buf.

Since (EFL) :
1.19.0
Eina_Bool eina_strbuf_append_vprintf ( Eina_Strbuf buf,
const char *  fmt,
va_list  args 
)

Appends data elements to a string buffer using a va_list.

Parameters:
[in,out]bufThe string buffer.
[in]fmtA formatting string.
[in]argsThe variable arguments.
Returns:
EINA_TRUE on success, EINA_FALSE on failure.
See also:
eina_strbuf_append_printf()
Since :
2.3
void eina_strbuf_free ( Eina_Strbuf buf)

Frees a string buffer.

Parameters:
[in,out]bufThe string buffer to free.

This function frees the memory of buf. buf must have been created by eina_strbuf_new().

Since :
2.3
Examples:
eina_strbuf_01.c, and entry_example.c.
Eina_Bool eina_strbuf_insert ( Eina_Strbuf buf,
const char *  str,
size_t  pos 
)

Inserts a string into a buffer, reallocating as necessary.

Parameters:
[in,out]bufThe string buffer.
[in]strThe string to insert.
[in]posThe position to insert the string.
Returns:
EINA_TRUE on success, EINA_FALSE if str could not be inserted.

This function inserts str into buf at position pos. It computes the length of str, so is slightly slower than eina_strbuf_insert_length(). If the length is known beforehand, consider using that variant.

Since :
2.3
Eina_Bool eina_strbuf_insert_char ( Eina_Strbuf buf,
char  c,
size_t  pos 
)

Inserts a character into a string buffer, reallocating as necessary.

Parameters:
[in,out]bufThe string buffer.
[in]cThe character to insert.
[in]posThe position to insert the character.
Returns:
EINA_TRUE on success, EINA_FALSE if c could not be inserted.

This function inserts c into buf at position pos.

Since :
2.3
Eina_Bool eina_strbuf_insert_escaped ( Eina_Strbuf buf,
const char *  str,
size_t  pos 
)

Inserts an escaped string into a buffer, reallocating as necessary.

Parameters:
[in,out]bufThe string buffer.
[in]strThe string to insert.
[in]posThe position to insert the string.
Returns:
EINA_TRUE on success, EINA_FALSE if str could not be inserted.

This function escapes and inserts the string str into buf at position pos.

Since :
2.3
Examples:
eina_strbuf_01.c.
Eina_Bool eina_strbuf_insert_length ( Eina_Strbuf buf,
const char *  str,
size_t  length,
size_t  pos 
)

Inserts a string of an exact length into a buffer, reallocating as necessary.

Parameters:
[in,out]bufThe string buffer.
[in]strThe string to insert.
[in]lengthThe exact length to use.
[in]posThe position to insert the string.
Returns:
EINA_TRUE on success, EINA_FALSE if string could not be inserted.

This function inserts str into buf. str must be no longer than length. It is slightly faster than eina_strbuf_insert() as it does not compute the size of str. It is useful when dealing with strings of known size, such as eina_stringshare.

See also:
eina_stringshare_length()
eina_strbuf_insert()
eina_strbuf_insert_n()
Since :
2.3
Eina_Bool eina_strbuf_insert_n ( Eina_Strbuf buf,
const char *  str,
size_t  maxlen,
size_t  pos 
)

Inserts a string of a maximum length into a buffer, reallocating as necessary.

Parameters:
[in,out]bufThe string buffer.
[in]strThe string to insert.
[in]maxlenThe maximum number of chars to insert.
[in]posThe position to insert the string.
Returns:
EINA_TRUE on success, EINA_FALSE if str could not be inserted.

This function inserts str into buf at position pos, with at most maxlen bytes. The number of inserted characters cannot be greater than the length of str. It computes the length of str, so is slightly slower than eina_strbuf_insert_length(). If the length is known beforehand, consider using that variant (maxlen should then be checked so that it is greater than the size of str).

Since :
2.3
Eina_Bool eina_strbuf_insert_printf ( Eina_Strbuf buf,
const char *  fmt,
size_t  pos,
  ... 
)

Inserts data elements into a buffer using printf-style formatting.

Parameters:
[in,out]bufThe string buffer.
[in]fmtThe string to insert.
[in]posThe position to insert the string.
[in]...Variable list of data parameters to be inserted.
Returns:
EINA_TRUE on success, EINA_FALSE if the string could not be inserted.

This function inserts a string as described by the format fmt into buf at the position pos. fmt must be of a valid format for printf family of functions.

Since :
2.3
Examples:
eina_strbuf_01.c.
Eina_Bool eina_strbuf_insert_slice ( Eina_Strbuf buf,
const Eina_Slice  slice,
size_t  pos 
)

Insert a slice into a buffer, reallocating as necessary.

Parameters:
[in,out]bufThe string buffer.
[in]sliceThe slice to insert.
[in]posThe position to insert the string.
Returns:
EINA_TRUE on success, EINA_FALSE if slice could not be inserted.

This function inserts slice into buf at position pos.

Since (EFL) :
1.19.0
Eina_Bool eina_strbuf_insert_vprintf ( Eina_Strbuf buf,
const char *  fmt,
size_t  pos,
va_list  args 
)

Inserts data elements into a buffer using a va_list.

Parameters:
[in,out]bufThe string buffer.
[in]fmtThe string to insert.
[in]posThe position to insert the string.
[in]argsThe variable arguments.
Returns:
EINA_TRUE on success, EINA_FALSE on failure.
See also:
eina_strbuf_insert_printf
Since :
2.3
size_t eina_strbuf_length_get ( const Eina_Strbuf buf)

Retrieves the length of the string buffer's content.

Parameters:
[in,out]bufThe string buffer.
Returns:
The current length of the string, in bytes.

This function returns the length of buf.

Since :
2.3
Examples:
eina_strbuf_01.c.
void eina_strbuf_ltrim ( Eina_Strbuf buf)

Left trims the string buffer.

Parameters:
[in,out]bufThe string buffer.

This function removes whitespace at the beginning of the buffer's string.

Since :
2.3

Creates a new string buffer using the passed string.

Parameters:
[in]strThe string to manage.
Returns:
Newly allocated string buffer instance, or NULL on error.

This function creates a new string buffer. The passed string is used directly as the buffer, it's effectively the inverse of eina_strbuf_string_steal(). The passed string must be malloc'd, and its ownership will transfer to Eina_Strbuf(do not free it with free()). To free the resources, use eina_strbuf_free().

See also:
eina_strbuf_free()
eina_strbuf_append()
eina_strbuf_string_get()
Since (EFL) :
1.1.0
Since :
2.3
Eina_Strbuf* eina_strbuf_manage_new_length ( char *  str,
size_t  length 
)

Creates a new string buffer using the passed string.

Parameters:
[in]strThe string to manage.
[in]lengthThe length of the string.
Returns:
Newly allocated string buffer instance, or NULL on error.

This function creates a new string buffer. The passed string is used directly as the buffer, it's effectively the inverse of eina_strbuf_string_steal(). The passed string must be malloc'd. To free the resources, use eina_strbuf_free().

See also:
eina_strbuf_manage_new()
Since (EFL) :
1.2.0
Since :
2.3
Eina_Strbuf* eina_strbuf_manage_read_only_new_length ( const char *  str,
size_t  length 
)

Creates a new string buffer using the passed string.

Parameters:
[in]strThe string to manage.
[in]lengthThe length of the string.
Returns:
Newly allocated string buffer instance, or NULL on error.

This function creates a new string buffer. The passed string is used directly as the buffer, it's effectively the inverse of eina_strbuf_string_steal(). The passed string is expected to be static or otherwise on the stack rather than the malloc'd string required by eina_strbuf_manage_new_length(). To free the resources, use eina_strbuf_free().

See also:
eina_strbuf_manage_new()
eina_strbuf_manage_new_length()
Since (EFL) :
1.9.0
Since :
3.0
Examples:
eina_strbuf_01.c.

Creates a new string buffer.

Returns:
Newly allocated string buffer instance, or NULL on error.

This function creates a new string buffer. To free the resources, use eina_strbuf_free().

See also:
eina_strbuf_free()
eina_strbuf_append()
eina_strbuf_string_get()
Since :
2.3
Examples:
eina_strbuf_01.c, and entry_example.c.
char* eina_strbuf_release ( Eina_Strbuf buf)

Frees the buffer, returning its old contents.

Parameters:
[in,out]bufThe string buffer.
Returns:
The string contained by buf. The caller must release the memory of the returned string by calling free().
Since (EFL) :
1.19
Eina_Bool eina_strbuf_remove ( Eina_Strbuf buf,
size_t  start,
size_t  end 
)

Removes a section from the given string buffer.

Parameters:
[in,out]bufThe string buffer.
[in]startThe initial (inclusive) byte position to start removal.
[in]endThe final (non-inclusive) byte position to end removal.
Returns:
EINA_TRUE on success, EINA_FALSE on failure.

This function removes a slice of buf, starting at start (inclusive) and ending at end (non-inclusive). Both values are in bytes.

Since :
2.3
Examples:
eina_strbuf_01.c.
Eina_Bool eina_strbuf_replace ( Eina_Strbuf buf,
const char *  str,
const char *  with,
unsigned int  n 
)

Replaces a substring in the buffer with another string.

Parameters:
[in,out]bufThe string buffer.
[in]strThe text to match.
[in]withThe replacement string.
[in]nThe indexed occurrence to be replaced.
Returns:
EINA_TRUE on success, EINA_FALSE on failure.

This function replaces the n-th occurrence of str in buf with with.

Since :
2.3
int eina_strbuf_replace_all ( Eina_Strbuf buf,
const char *  str,
const char *  with 
)

Replaces all matching substrings with another string.

Parameters:
[in,out]bufThe string buffer.
[in]strThe text to match.
[in]withThe replacement string.
Returns:
Number of replacements made, or 0 on failure.

This function replaces all the occurrences of str in buf with the string with.

Since :
2.3
Examples:
eina_strbuf_01.c.
Eina_Bool eina_strbuf_replace_last ( Eina_Strbuf buf,
const char *  str,
const char *  with 
)

Replaces the last occurrence of a substring with another string.

Parameters:
[in,out]bufThe string buffer.
[in]strThe text to match.
[in]withThe replacement string.
Returns:
EINA_TRUE on success, EINA_FALSE on failure.

This function replaces the last occurrence of str in buf with with.

void eina_strbuf_reset ( Eina_Strbuf buf)

Resets a string buffer.

Parameters:
[in,out]bufThe string buffer.

This function resets buf: the buffer len is set to 0, and the string data is set to '\0'. No memory is freed.

Since :
2.3
Examples:
eina_strbuf_01.c.
void eina_strbuf_rtrim ( Eina_Strbuf buf)

Right trims the string buffer.

Parameters:
[in,out]bufThe string buffer.

This function removes whitespace at the end of the buffer's string.

Since :
2.3

Gets a read-write slice of the buffer contents.

Parameters:
[in]bufThe string buffer.
Returns:
A read-write slice for the current contents. It may become invalid as soon as the buf is changed, such as through calls like eina_strbuf_append() or eina_strbuf_remove().
Since (EFL) :
1.19.0

Gets a read-only slice of the buffer contents.

Parameters:
[in]bufThe string buffer.
Returns:
A read-only slice of the current contents. It may become invalid as soon as buf is changed.
Since (EFL) :
1.19

Frees the contents of a string buffer but not the buffer.

Parameters:
[in,out]bufThe string buffer.

This function frees the string contained in buf without freeing buf.

Since :
2.3
const char* eina_strbuf_string_get ( const Eina_Strbuf buf)

Retrieves a pointer to the contents of a string buffer.

Parameters:
[in]bufThe string buffer.
Returns:
The current string in the string buffer.

This function returns the string contained in buf. The returned value must not be modified and will no longer be valid if buf is modified. In other words, calling eina_strbuf_append() or similar functions will make this pointer invalid. The pointer returned by this function must not be freed.

See also:
eina_strbuf_string_steal()
Since :
2.3
Examples:
eina_strbuf_01.c, and entry_example.c.

Steals the contents of a string buffer.

Parameters:
[in,out]bufThe string buffer.
Returns:
The string that was contained in buf.

This function returns the string contained in buf. buf is then initialized and does not own the returned string anymore. The caller must release the memory of the returned string by calling free().

See also:
eina_strbuf_string_get()
Since :
2.3

Converts the string to lower case.

Parameters:
[in,out]bufThe string buffer.

This function converts all the characters in the buffer's string to lower case.

Since (EFL) :
1.17
Since :
3.0
Examples:
eina_strbuf_01.c.
void eina_strbuf_trim ( Eina_Strbuf buf)

Trims the string buffer.

Parameters:
[in,out]bufThe string buffer.

This function removes whitespace at the beginning and end of the buffer's string.

Since :
2.3