The "string_trim" Function

Syntax#

string_trim(str, [filter]);
ArgumentTypeDescription
strstringThe string to modify
[filter]stringOptional: A custom list of characters to be trimmed

Description#

Removes spaces from either side of the string and returns the trimmed result.

If a filter is supplied, any character in the filter string will be trimmed instead. (To also trim spaces, include a space in the filter string.)

Example#

var notes = " +[do, re, mi, fa, so, la, ti, do] % ";
notes = string_trim(notes, " []+%");
draw_text(x, y, notes);