📜  game maker studio 2 字符串拆分 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:54.776000             🧑  作者: Mango

代码示例1
///string_split_qt(string)
var arr = undefined;
var at = 0;
var my_str = argument0;
var sub_str = "";
var Quote = false;
for(var i = 1; i < string_length(my_str)+1; i++)
{
   var next_char = string_char_at(my_str,i);
 
   if(next_char == "'")
   {
        Quote = !Quote;
   }
   else if (next_char != " " || Quote)
   {
       sub_str = sub_str + next_char;
   }
   else
   {
       //ADD TO ARRAY
       if(sub_str!="") arr[at++] = sub_str;
       sub_str = "";
   }
}
if(sub_str!="") arr[at++] = sub_str;
return arr;