GLib.utf8_substring

function utf8_substring(str: String, start_pos: Number(glong), end_pos: Number(glong)): String {
    // Gjs wrapper for g_utf8_substring()
}
  

Copies a substring out of a UTF-8 encoded string. The substring will contain end_pos - start_pos characters.

Since 2.30

str

a UTF-8 encoded string

start_pos

a character offset within str

end_pos

another character offset within str

Returns

a newly allocated copy of the requested substring. Free with GLib.free when no longer needed.