Function

GLibutf8_substring

Declaration

gchar*
g_utf8_substring (
  const gchar* str,
  glong start_pos,
  glong end_pos
)

Description

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

Available since:2.30

Parameters

str const gchar*
 

A UTF-8 encoded string.

 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.
start_pos glong
 

A character offset within str.

end_pos glong
 

Another character offset within str.

Return value

Returns: gchar*
 

A newly allocated copy of the requested substring. Free with g_free() when no longer needed.

 The caller of the function takes ownership of the data, and is responsible for freeing it.
 The string is a NUL terminated UTF-8 string.