strip


Description:

public string strip ()

Removes leading and trailing whitespace from a string.

Example: Remove leading and trailing whitespace:

public static int main (string[] args) {
string my_wisdom = " \t You're standing on my scarf. ";
string res = my_wisdom.strip ();

// Output:
// ``' You're standing on my scarf. '``
// ``'You're standing on my scarf.'``
print ("'%s'\n", my_wisdom);
print ("'%s'\n", res);

return 0;
}

valac --pkg glib-2.0 string.strip.vala

Returns:

a newly-allocated string holding the result

See also:

string._chomp, string._chug, string._strip, string.chomp, string.chug