Someone
public text v1 · immutablestatic gchar *
escape_under_score (const gchar *text)
{
GString *str;
gint length;
const gchar *p;
const gchar *end;
g_return_val_if_fail (text != NULL, NULL);
length = strlen (text);
str = g_string_sized_new (length);
p = text;
end = text + length;
while (p != end)
{
const gchar *next;
next = g_utf8_next_char (p);
if (*p == '_')
g_string_append (str, "");
else
g_string_append_len (str, p, next - p);
p = next;
}
return g_string_free (str, FALSE);
}