assign


Description:

public unowned StringBuilder assign (string rval)

Copies the bytes from a string into a StringBuilder, destroying any previous contents.

It is rather like the standard strcpy function, except that you do not have to worry about having enough space to copy the string.

Example: Override the content:

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

// Output: ``hello, olymp!``
builder.assign ("hello, olymp!\n");
print (builder.str);
return 0;
}

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

Parameters:

this

the destination StringBuilder. Its current contents are destroyed.

rval

the string to copy into this

Returns:

this