dup_string
Description:
Similar to get_string except that instead of returning a constant string, the string is duplicated.
The string will always be UTF-8 encoded.
The return value must be freed using g_free.
Example: Get a copy of the string:
public static int main (string[] args) {
Variant var1 = new Variant.string ("Hello, world!");
size_t length = 0;
// Output: ``'Hello, world!', 13``
print ("'%s', %"+size_t.FORMAT+"\n", var1.dup_string (out length), length);
return 0;
}
valac --pkg glib-2.0 GLib.Variant.dup_string.vala
Parameters:
this |
a string Variant instance |
length |
a pointer to a size_t, to store the length |
Returns:
a newly allocated string, UTF-8 encoded |