static S replaceNumbersWithVars(S s, final F0<S> varMaker) { final new SS map; ret regexpReplace(s, "\\d+", func(Matcher m) -> S { S number = m.group(); S var = map.get(number); if (var == null) map.put(number, var = varMaker!); ret var; }); }
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: | 278 / 298 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1021184 - replaceNumbersWithABCDollarVars #1021188 - replaceNumbersWithVars_returnMap |