Method code for $string.explode_template_word()

[Turn off line numbering]
  1: arg template;
  2: var t, x, idx, out, new;
  3: 
  4: // this only explodes single word templates
  5: template = template.explode("|");
  6: out = [];
  7: for t in (template) {
  8:     idx = "?" in t;
  9:     if (idx) {
 10:         t = t.strip("?");
 11:         new = t.subrange(1, idx - 1);
 12:         out += [new];
 13:         for x in [idx .. t.length()] {
 14:             new += t[x];
 15:             out += [new];
 16:         }
 17:     } else {
 18:         out += [t];
 19:     }
 20: }
 21: return out;

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

Tlon