[ CCode ( cname = "g_strchug" ) ]
public unowned string _chug ()

Removes leading whitespace from a string, by moving the rest of the characters forward.

This function doesn't allocate or reallocate any memory; it modifies string in place. Therefore, it cannot be used on statically allocated strings.

The pointer to string is returned to allow the nesting of functions.

Also see [func@GLib.strchomp] and [func@GLib.strstrip].

Example: Remove leading whitespace from a string (inline):

public static int main (string[] args) {
string my_wisdom = " \t Don't worry, I'll soon fix that. ";
unowned string res = my_wisdom._chug ();

// Output:
// ``' Don't worry, I'll soon fix that. '``
// ``'Don't worry, I'll soon fix that. '``
print ("'%s'\n", my_wisdom);
print ("'%s'\n", res);

return 0;

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



a string to remove the leading whitespace from


the modified string