Function

GLib-2.0GLibstrcanon

  • For each character in string, if the character is not in valid_chars, replaces the character with substitutor.

    Modifies string in place, and return string itself, not a copy. The return value is to allow nesting such as:

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

    In order to modify a copy, you may use GLib.strdup:

    reformatted = g_strcanon (g_strdup (const_str), "abc", '?');

    g_free (reformatted);

    Parameters

    • string: string

      a nul-terminated array of bytes

    • valid_chars: string

      bytes permitted in string

    • substitutor: number

      replacement character for disallowed bytes

    Returns string

    the modified string