Libraryless. Click here for Pure Java version (2725L/17K).
// f takes variable without $ sign. if it returns null, variable is kept sS replaceDollarVars_dyn(S s, IF1<S> f) { if (f == null) ret s; ret regexpReplaceIC(s, "\\$(\\w+)", matcher -> { S var = matcher.group(1); S val = f.get(var); ret val == null ? matcher.group() : str(val); }); }
Began life as a copy of #1028680
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1030433 | 
| Snippet name: | replaceDollarVars_dyn - does not use a tokenizer | 
| Eternal ID of this version: | #1030433/1 | 
| Text MD5: | 7b86bc8bb41da08e4f7aed4d6fece1ed | 
| Transpilation MD5: | b9d295ae79cb239151c98e2527f7580a | 
| Author: | stefan | 
| Category: | javax | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2020-12-16 23:12:31 | 
| Source code size: | 309 bytes / 9 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 497 / 638 | 
| Referenced in: | [show references] |