Libraryless. Click here for Pure Java version (2797L/18K).
sS replaceSquareBracketVars(S s, O... params) { if (empty(params)) ret s; MapSO vars = mapKeys deSquareBracket((MapSO) litcimap(params)); ret regexpReplaceIC(s, "\\[(.+?)\\]", matcher -> { S var = matcher.group(1); O val = vars.get(var); ret val == null ? matcher.group() : str(val); }); }
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1028669 |
| Snippet name: | replaceSquareBracketVars |
| Eternal ID of this version: | #1028669/6 |
| Text MD5: | ebbdde2bcaa11e9bd272c2e91b83a1b5 |
| Transpilation MD5: | c47018881f27dc55ad1570e420b1174a |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-09-11 15:23:35 |
| Source code size: | 317 bytes / 9 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 416 / 598 |
| Version history: | 5 change(s) |
| Referenced in: | [show references] |