prepend_len


Description:

public unowned StringBuilder prepend_len (string val, ssize_t len)

Prepends len bytes of val to this.

If len is positive, val may contain embedded nuls and need not be nul-terminated. It is the caller's responsibility to ensure that val has at least len addressable bytes.

If len is negative, val must be nul-terminated and len is considered to request the entire string length. This makes prepend_len equivalent to prepend.

Example: Prepend n bytes of a string:

public static int main (string[] args) {
// Output: ``hello, world!``
StringBuilder builder = new StringBuilder (", world!\n");
builder.prepend_len ("hello, world!", 5);
print (builder.str);
return 0;
}

valac --pkg glib-2.0 GLib.StringBuilder.prepend_len.vala

Parameters:

this

a StringBuilder

val

bytes to prepend

len

number of bytes in val to prepend, or -1 for all of val

Returns:

this