string_trim_start

This function returns a new string with all leading white-space characters removed.

NOTE The following characters are white-space characters: space (" "), tab ("\t"), carriage return ("\r"), newline ("\n"), form feed ("\f") and vertical tab ("\v"). See White-space Characters for the full list, including Unicode characters.

 

Syntax:

string_trim_start(str);

Argument Type Description
str String The string to trim

 

Returns:

String

 

Example:

var _string_with_a_bit_of_everything = "     \t\t\t\tHello World";
var _trimmed_string = string_trim_start(_string_with_a_bit_of_everything);
show_debug_message(_trimmed_string);

The above code first creates a temporary string named _string_with_a_bit_of_everything. This string contains a couple of leading spaces and tabs before the actual text. It then trims all whitespace from the start of the string by calling string_trim_start and the result is stored in a new temporary variable _trimmed_string. Finally this new string is shown in a debug message.