1 | static Pair<S, SS> replaceNumbersWithVars_returnMap(S s, final F0<S> varMaker) { |
2 | final new SS map; |
3 | ret pair(regexpReplace(s, "\\d+", func(Matcher m) -> S { |
4 | S number = m.group(); |
5 | S var = map.get(number); |
6 | if (var == null) |
7 | map.put(number, var = varMaker!); |
8 | ret var; |
9 | }), map); |
10 | } |
Began life as a copy of #1021182
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1021188 |
Snippet name: | replaceNumbersWithVars_returnMap |
Eternal ID of this version: | #1021188/3 |
Text MD5: | 42ce5aa6f9ed23ad9f67dacdb09e3535 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-02-02 14:40:39 |
Source code size: | 311 bytes / 10 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 297 / 331 |
Version history: | 2 change(s) |
Referenced in: | [show references] |