[Turn on line numbering]arg line, @opts; var x, output, tmp; if (!line) return []; // explodes an english list ("foo, bar and zoo"). line = line.explode(","); output = []; for x in (line) { x = .trim(x); if ((| x.subrange(1, 4) |) == "and ") output += [.trim(x.subrange(4))]; else output += [x]; } // check the last element, if they didn't specify 'noand if (!('noand in opts)) { line = output[output.length()].explode(); tmp = ""; for x in [1 .. line.length()] { if (line[x] == "and") { output = output.delete(output.length()); if (tmp) output += [tmp]; tmp = line.subrange(x + 1).join(); if (tmp) output += [tmp]; // only bother with the first "and" break; } tmp = tmp + (tmp ? " " : "") + line[x]; } } return output;
// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit