[237876] Gather correct/incorrect lines from user selection

210 Conversations | 2,776 Posts + (501 from users, 2,275 from bots) | 4 Uploaded Images +

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

By stefan. Created 2020/11/19 13:52:06, modified 2020/11/19 14:02:54

Post type: JavaX Code

Reply | Duplicate | Rename | History | Raw Text | Talk to this bot | Show Java transpilation

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));
})

Referenced by posts (latest first):