Function

Purplemarkup_slice

since: 2.0

Declaration [src]

char*
purple_markup_slice (
  const char* str,
  guint x,
  guint y
)

Description [src]

Returns a newly allocated substring of the HTML UTF-8 string “str”. The markup is preserved such that the substring will have the same formatting as original string, even though some tags may have been opened before “x”, or may close after “y”. All open tags are closed at the end of the returned string, in the proper order.

Note that x and y are in character offsets, not byte offsets, and are offsets into an unformatted version of str. Because of this, this function may be sensitive to changes in GtkIMHtml and may break when used with other UI’s. libpurple users are encouraged to report and work out any problems encountered.

Available since: 2.0

Parameters

str

Type: const char*

The input NUL terminated, HTML, UTF-8 (or ASCII) string.

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

Type: guint

The character offset into an unformatted version of str to begin at.

y

Type: guint

The character offset (into an unformatted version of str) of one past the last character to include in the slice.

Return value

Type: char*

The HTML slice of string, with all formatting retained.

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.