utf8Substring

fnstring utf8Substring(string str, glong startPos, glong endPos)

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

Since GLib 2.72, -1 can be passed to end_pos to indicate the end of the string.

Parameters

stra UTF-8 encoded string
startPosa character offset within str
endPosanother character offset within str, or -1 to indicate the end of the string

Returns

a newly allocated copy of the requested

substring. Free with [glib.global.gfree] when no longer needed.