Skip to content

Instantly share code, notes, and snippets.

@lofcz
Created May 3, 2018 19:12
Show Gist options
  • Save lofcz/d3ecd3aaad563d8965f512cdceea3c18 to your computer and use it in GitHub Desktop.
Save lofcz/d3ecd3aaad563d8965f512cdceea3c18 to your computer and use it in GitHub Desktop.
// use string_numbers to get rid of descr.
/// string_parse(str,token,ignore)
/// @arg str
/// @arg token
/// @arg ignore
var str,token,ignore,list,tlen,temp;
str = argument0;
token = argument1;
ignore = argument2;
list = ds_list_create();
tlen = string_length( token);
while (string_length(str) != 0)
{
temp = string_pos(token,str);
if (temp)
{
if (temp != 1 || !ignore) ds_list_add(list,string_copy(str,1,temp-1));
str = string_copy(str,temp+tlen,string_length(str));
}
else
{
ds_list_add(list,str);
str = "";
}
}
return list;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment