Created
May 3, 2018 19:12
-
-
Save lofcz/d3ecd3aaad563d8965f512cdceea3c18 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// use string_numbers to get rid of descr. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 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