Function

GLibutf8_find_prev_char

since: 2.0

Declaration

gchar*
g_utf8_find_prev_char (
  const gchar* str,
  const gchar* p
)

Description

Given a position p with a UTF-8 encoded string str, find the start of the previous UTF-8 character starting before p. Returns NULL if no UTF-8 characters are present in str before p.

p does not have to be at the beginning of a UTF-8 character. No check is made to see if the character found is actually valid other than it starts with an appropriate byte.

Available since: 2.0

Parameters

str

Type: const gchar*

Pointer to the beginning of a UTF-8 encoded string.

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

Type: const gchar*

Pointer to some position within str.

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

Return value

Type: gchar*

A pointer to the found character or NULL.

The data is owned by the called function.
The return value can be NULL.
The value is a NUL terminated UTF-8 string.