String Utility Functions

String Utility Functions — Various string-related functions.

Synopsis


#include <exo/exo.h>


gchar*      exo_str_elide_underscores       (const gchar *text);
gboolean    exo_str_is_equal                (const gchar *a,
                                             const gchar *b);
gchar**     exo_strndupv                    (gchar **strv,
                                             gint num);

Description

This section describes a number of utility functions for manipulating strings.

Details

exo_str_elide_underscores ()

gchar*      exo_str_elide_underscores       (const gchar *text);

Returns a copy of text with all mnemonic underscores stripped off.

text : A zero terminated string.
Returns : A copy of text without underscores. The returned string must be freed when no longer required.

exo_str_is_equal ()

gboolean    exo_str_is_equal                (const gchar *a,
                                             const gchar *b);

NULL-safe string comparison. Returns TRUE if both a and b are NULL or if a and b refer to valid strings which are equal.

You should always prefer this function over strcmp().

a : A pointer to first string or NULL.
b : A pointer to second string or NULL.
Returns : TRUE if a equals b, else FALSE.

exo_strndupv ()

gchar**     exo_strndupv                    (gchar **strv,
                                             gint num);

Creates a new string vector containing the first n elements of strv.

strv : String vector to duplicate.
num : Number of strings in strv to duplicate.
Returns : The new string vector. Should be freed using g_strfreev() when no longer needed.