Skip to main content

The "string_explode" Function


string_explode(str, delim, [limit]);
strstringThe string to split into an array
delimstringA repeated substring at which point the string will be split
[limit]integerOptional: Sets a limit on the number of times the string will be split


Splits a string into a 1D array, using a delimeter character (or substring) to separate contents. The delimeter will not be included in the resulting strings.

If a limit value is supplied, only that number of delimeter matches will be made, and the final value in the array will contain the remainder of the unsplit string. To exclude the remainder from the array, input the limit value as negative.

Note that the resulting strings will automatically be trimmed, meaning you do not need to include spaces in the delimeter string (unless space itself is the delimeter). Spaces will automatically be removed.


var notes = "do | re | mi | fa | so | la | ti | do";
notes = string_explode(notes, "|");
draw_text(x, y, notes[0]);