GLib.strcanon

function strcanon(string: String, valid_chars: String, substitutor: Number(gchar)): String {
    // Gjs wrapper for g_strcanon()
}
  

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 |[<!-- language="C" --> g_ascii_strup (g_strcanon (str, "abc", '?')) ]|

string

a nul-terminated array of bytes

valid_chars

bytes permitted in string

substitutor

replacement character for disallowed bytes

Returns

string