StringBuilder
Object Hierarchy:
Description:
[ Compact ]
[ GIR ( name = "String" ) ]
[ CCode ( cname = "GString" , cprefix = "g_string_" , free_function = "g_string_free" , type_id = "G_TYPE_GSTRING" ) ]
public class StringBuilder
[ GIR ( name = "String" ) ]
[ CCode ( cname = "GString" , cprefix = "g_string_" , free_function = "g_string_free" , type_id = "G_TYPE_GSTRING" ) ]
public class StringBuilder
The GString struct contains the public fields of a GString.
Namespace: GLib
Package: glib-2.0
Content:
Properties:
Static methods:
- public static Bytes free_to_bytes (owned StringBuilder str)
Transfers ownership of the contents of this to a newly allocated Bytes.
Creation methods:
- public StringBuilder (string init = "")
Creates a new StringBuilder, initialized with the given string.
- public StringBuilder.from_buffer (char[] init)
Creates a new StringBuilder with
len
bytes of theinit
buffer. - public StringBuilder.sized (size_t dfl_size)
Creates a new StringBuilder, with enough space for
dfl_size
bytes. - public StringBuilder.take (owned string init)
Creates a new StringBuilder, initialized with the given string.
Methods:
- public unowned StringBuilder append (string val)
Adds a string onto the end of a StringBuilder, expanding it if necessary.
- public unowned StringBuilder append_c (char c)
Adds a byte onto the end of a StringBuilder, expanding it if necessary.
- public unowned StringBuilder append_len (string val, ssize_t len)
Appends
len
bytes ofval
to this. - public void append_printf (string format, ...)
Appends a formatted string onto the end of a StringBuilder.
- public unowned StringBuilder append_unichar (unichar wc)
Converts a Unicode character into UTF-8, and appends it to the string.
- public void append_vprintf (string format, va_list args)
Appends a formatted string onto the end of a StringBuilder.
- public unowned StringBuilder assign (string rval)
Copies the bytes from a string into a StringBuilder , destroying any previous contents.
- public unowned StringBuilder erase (ssize_t pos = 0, ssize_t len = -1)
Removes
len
bytes from a StringBuilder , starting at positionpos
. - public string free_and_steal ()
Frees the memory allocated for the StringBuilder.
- public unowned StringBuilder insert (ssize_t pos, string val)
Inserts a copy of a string into a StringBuilder, expanding it if necessary.
- public unowned StringBuilder insert_len (ssize_t pos, string val, ssize_t len)
Inserts
len
bytes ofval
into this atpos
. - public unowned StringBuilder insert_unichar (ssize_t pos, unichar wc)
Converts a Unicode character into UTF-8, and insert it into the string at the given position.
- public unowned StringBuilder overwrite (size_t pos, string val)
Overwrites part of a string, lengthening it if necessary.
- public unowned StringBuilder overwrite_len (size_t pos, string val, ssize_t len)
Overwrites part of a string, lengthening it if necessary.
- public unowned StringBuilder prepend (string val)
Adds a string on to the start of a StringBuilder, expanding it if necessary.
- public unowned StringBuilder prepend_c (char c)
Adds a byte onto the start of a StringBuilder, expanding it if necessary.
- public unowned StringBuilder prepend_len (string val, ssize_t len)
Prepends
len
bytes ofval
to this. - public unowned StringBuilder prepend_unichar (unichar wc)
Converts a Unicode character into UTF-8, and prepends it to the string.
- public void printf (string format, ...)
Writes a formatted string into a StringBuilder.
- public uint replace (string find, string replace, uint limit = 0)
Replaces the string
find
with the stringreplace
in a StringBuilder up tolimit
times. - public unowned StringBuilder truncate (size_t len = 0)
Cuts off the end of the GString, leaving the first
len
bytes. - public void vprintf (string format, va_list args)
Writes a formatted string into a StringBuilder.