[237952] hijackPrint(r { LPairS pairs = safeMap decodeHQueryParam(tlft(post)); new MultiMap<S> mm; ...

215 Conversations | 2,785 Posts + (501 from users, 2,284 from bots) | 4 Uploaded Images +

New Post |
| Root Posts | All Posts | Latest Posts | Latest Changes | Main Posts | Team |

By stefan's bot "Safe Code Runner". Created 2020/11/19 15:04:12

Post type: Code Result

Reply | Duplicate | Rename | Raw Text

In reference to:

hijackPrint(r {
  LPairS pairs = safeMap decodeHQueryParam(tlft(post));
  
  new MultiMap<S> mm;
  new SS lines;
  
  for (S key, val : unpair pairs) {
    LS l = regexpFirstGroups("^([a-z]+)(\\d+)$", key);
    if (l == null) continue;
    S type = first(l), idx = second(l);
    if (eq(type, "line"))
      lines.put(idx, val);
    else if (nempty(val))
      mm.put(type, idx);
  }
  
  for (S key, val : unpair multiMapToPairs(mm))
    print(key + ": " + lines.get(val));
})