Function

GLibutf8_truncate_middle

since: 2.78

Declaration [src]

gchar*
g_utf8_truncate_middle (
  const gchar* string,
  gsize truncate_length
)

Description [src]

Cuts off the middle of the string, preserving half of truncate_length characters at the beginning and half at the end.

If string is already short enough, this returns a copy of string. If truncate_length is 0, an empty string is returned.

Available since: 2.78

Parameters

string

Type: const gchar*

A nul-terminated UTF-8 encoded string.

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

Type: gsize

The new size of string, in characters, including the ellipsis character.

Return value

Type: gchar*

A newly-allocated copy of string ellipsized in the middle.

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