Function

GLibstrdelimit

Declaration [src]

gchar*
g_strdelimit (
  gchar* string,
  const gchar* delimiters,
  gchar new_delimiter
)

Description [src]

Converts any delimiter characters in string to new_delimiter.

Any characters in string which are found in delimiters are changed to the new_delimiter character. Modifies string in place, and returns string itself, not a copy.

The return value is to allow nesting such as:

  g_ascii_strup (g_strdelimit (str, "abc", '?'))

In order to modify a copy, you may use g_strdup():

  reformatted = g_strdelimit (g_strdup (const_str), "abc", '?');
  ...
  g_free (reformatted);

Parameters

string gchar*
 

The string to convert.

 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.
delimiters const gchar*
 

A string containing the current delimiters, or NULL to use the standard delimiters defined in #G_STR_DELIMITERS.

 The argument can be NULL.
 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.
new_delimiter gchar
 

The new delimiter character.

Return value

Returns: gchar*
 

The modified string.

 The caller of the function takes ownership of the data, and is responsible for freeing it.
 The string is a NUL terminated UTF-8 string.