Function

GLibutf8_strlen

Declaration [src]

glong
g_utf8_strlen (
  const gchar* p,
  gssize max
)

Description [src]

Computes the length of the string in characters, not including the terminating nul character. If the max’th byte falls in the middle of a character, the last (partial) character is not counted.

Parameters

p

Type: const gchar*

Pointer to the start 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.
max

Type: gssize

The maximum number of bytes to examine. If max is less than 0, then the string is assumed to be nul-terminated. If max is 0, p will not be examined and may be NULL. If max is greater than 0, up to max bytes are examined.

Return value

Type: glong

The length of the string in characters.