StringJoiner
Object Hierarchy:
Description:
public class StringJoiner : Object
StringJoiner constructs a sequence of characters separated by a delimiter and optionally starting with a prefix and ending with a suffix.
This is equivalent to Java's StringJoiner.
Example:
var joiner = new StringJoiner (", ", "[", "]");
joiner.add ("a");
joiner.add ("b");
joiner.add ("c");
assert (joiner.toString () == "[a, b, c]");
Content:
Creation methods:
Methods:
- public StringJoiner add (string element)
Adds an element to this joiner.
- public int length ()
Returns the length of the string that would be produced by toString().
- public StringJoiner merge (StringJoiner other)
Merges the contents of another StringJoiner into this one. The other
joiner's elements are added without its prefix and suffix, using its delimiter to join them as a single element.
- public StringJoiner setEmptyValue (string value)
Sets the value to return from toString() when no elements have been
added. By default, the empty value is prefix + suffix.
- public string toString ()
Returns the joined string with prefix, delimiter-separated elements,
and suffix. If no elements have been added, returns the empty value (or prefix + suffix if none was set).
Inherited Members:
All known members inherited from class GLib.Object
- @get
- @new
- @ref
- @set
- add_toggle_ref
- add_weak_pointer
- bind_property
- connect
- constructed
- disconnect
- dispose
- dup_data
- dup_qdata
- force_floating
- freeze_notify
- get_class
- get_data
- get_property
- get_qdata
- get_type
- getv
- interface_find_property
- interface_install_property
- interface_list_properties
- is_floating
- new_valist
- new_with_properties
- newv
- notify
- notify_property
- ref_count
- ref_sink
- remove_toggle_ref
- remove_weak_pointer
- replace_data
- replace_qdata
- set_data
- set_data_full
- set_property
- set_qdata
- set_qdata_full
- set_valist
- setv
- steal_data
- steal_qdata
- thaw_notify
- unref
- watch_closure
- weak_ref
- weak_unref