String

class String(pointer: <Error class: unknown class><<Error class: unknown class>>) : Record

A GString is an object that handles the memory management of a C string.

The emphasis of GString is on text, typically UTF-8. Crucially, the "str" member of a GString is guaranteed to have a trailing nul character, and it is therefore always safe to call functions such as strchr() or strdup() on it.

However, a GString can also hold arbitrary binary data, because it has a "len" member, which includes any possible embedded nul characters in the data. Conceptually then, GString is like a GByteArray with the addition of many convenience methods for text, and a guaranteed nul terminator.

Skipped during bindings generation

  • method append: C function g_string_append is ignored

  • method append_c: C function g_string_append_c is ignored

  • method append_len: C function g_string_append_len is ignored

  • method append_unichar: C function g_string_append_unichar is ignored

  • method append_uri_escaped: C function g_string_append_uri_escaped is ignored

  • method ascii_down: C function g_string_ascii_down is ignored

  • method ascii_up: C function g_string_ascii_up is ignored

  • method assign: C function g_string_assign is ignored

  • method down: C function g_string_down is ignored

  • method equal: C function g_string_equal is ignored

  • method erase: C function g_string_erase is ignored

  • method free: C function g_string_free is ignored

  • method free_and_steal: C function g_string_free_and_steal is ignored

  • method free_to_bytes: C function g_string_free_to_bytes is ignored

  • method hash: C function g_string_hash is ignored

  • method insert: C function g_string_insert is ignored

  • method insert_c: C function g_string_insert_c is ignored

  • method insert_len: C function g_string_insert_len is ignored

  • method insert_unichar: C function g_string_insert_unichar is ignored

  • method overwrite: C function g_string_overwrite is ignored

  • method overwrite_len: C function g_string_overwrite_len is ignored

  • method prepend: C function g_string_prepend is ignored

  • method prepend_c: C function g_string_prepend_c is ignored

  • method prepend_len: C function g_string_prepend_len is ignored

  • method prepend_unichar: C function g_string_prepend_unichar is ignored

  • method replace: C function g_string_replace is ignored

  • method set_size: C function g_string_set_size is ignored

  • method truncate: C function g_string_truncate is ignored

  • method up: C function g_string_up is ignored

  • constructor new: C function g_string_new is ignored

  • constructor new_len: C function g_string_new_len is ignored

  • constructor new_take: C function g_string_new_take is ignored

  • constructor sized_new: C function g_string_sized_new is ignored

Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion : RecordCompanion<String, <Error class: unknown class>>

Properties

Link copied to clipboard
var allocatedLen: <Error class: unknown class>

the number of bytes that can be stored in the string before it needs to be reallocated. May be larger than @len.

Link copied to clipboard
val glibStringPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
var len: <Error class: unknown class>

contains the length of the string, not including the terminating nul byte.

Link copied to clipboard
val str: String?

points to the character data. It may move as text is added. The @str field is null-terminated and so can be used as an ordinary C string.