Working with strings

Working with strings — functions to create and manipulate strings and string-arrays.

Functions

GList * gx_strv_to_list ()
GList * gx_strv_to_list_copy ()
gchar * gx_utf8_flatten ()

Description

Some functions for common operations on strings and arrays of strings.

Functions

gx_strv_to_list ()

GList *
gx_strv_to_list (gchar **strv,
                 gssize n);

Create a GList from the string in strv . The strings are not copied.

Parameters

strv

an array of strings

 

n

the number of strings in the array, or < 0 if it is NULL-terminated.

 

Returns

a list with the strings; free with g_list_free().

[transfer full]


gx_strv_to_list_copy ()

GList *
gx_strv_to_list_copy (gchar **strv,
                      gssize n);

Create a GList from the string in strv and copy the strings.

Parameters

strv

an array of strings

 

n

the number of strings in the array, or < 0 if it is NULL-terminated.

 

Returns

a list with the strings; free with g_list_free_full() using g_free().

[transfer full]


gx_utf8_flatten ()

gchar *
gx_utf8_flatten (const gchar *str,
                 gssize len);

Flatten some UTF-8 string; that is, downcase it and remove any diacritics.

Parameters

str

a UTF-8 string

 

len

the length of str , or -1 if it is NULL-terminated

 

Returns

a flattened string, free with g_free().

[transfer full]

Types and Values