Method code for $string.explode_quoted()

[Turn off line numbering]
  1: arg str;
  2: var out, result, x, qstr;
  3: 
  4: out = [];
  5: 
  6: // HACK: we need to make this a native--its horribly inefficient
  7: qstr = "#$#QUOTE-" + time() + "#$#";
  8: str = strsub(str, "\\"", qstr);
  9: while (str) {
 10:     result = match_pattern(str, "*\"*\"*");
 11:     if (result) {
 12:         out += result[1].explode() + [result[2].trim()];
 13:         str = result[3];
 14:     } else {
 15:         out += str.explode();
 16:         str = "";
 17:     }
 18: }
 19: for x in [1 .. listlen(out)]
 20:     out = replace(out, x, strsub(out[x], qstr, "\""));
 21: return out;

// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit

Tlon