1 | static S replaceNumbersWithVars(S s, final F0<S> varMaker) { |
2 | final new SS map; |
3 | ret 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 | }); |
10 | } |
Began life as a copy of #1003610
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: | #1021182 |
Snippet name: | replaceNumbersWithVars |
Eternal ID of this version: | #1021182/1 |
Text MD5: | 44908261627f6a9b25fd4c6edf436489 |
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:28:45 |
Source code size: | 280 bytes / 10 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 277 / 298 |
Referenced in: | [show references] |