Libraryless. Click here for Pure Java version (3079L/18K).
1 | static <A> S replaceAngleBracketVars(S s, Map<S, A> map) { |
2 | ret empty(map) ? s : join(replaceAngleBracketVars(javaTokWithAngleBrackets(s), map)); |
3 | } |
4 | |
5 | static <A> LS replaceAngleBracketVars(LS tok, Map<S, A> map, BitSet replacedTokens_out default null) { |
6 | if (empty(map)) ret tok; |
7 | tok = cloneList(tok); |
8 | for (int i = 1; i < l(tok); i += 2) { |
9 | S t = tok.get(i); |
10 | if (isAngleBracketed(t)) { |
11 | A t2 = map.get(t); |
12 | if (t2 == null) t2 = map.get(deAngleBracket(t)); |
13 | if (t2 != null) { |
14 | tok.set(i, str(t2)); |
15 | bitSetSet(replacedTokens_out, i); |
16 | } |
17 | } |
18 | } |
19 | ret tok; |
20 | } |
21 | |
22 | sS replaceAngleBracketVars(S s, O... params) { |
23 | ret replaceAngleBracketVars(s, paramsToMap(params)); |
24 | } |
Began life as a copy of #1004293
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030852 |
Snippet name: | replaceAngleBracketVars |
Eternal ID of this version: | #1030852/8 |
Text MD5: | 55a41f2e87b6fb02c833efbb67cc7f0f |
Transpilation MD5: | de95ac56d3417b73c1baa279aa6e974a |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-04-15 16:50:43 |
Source code size: | 730 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 193 / 284 |
Version history: | 7 change(s) |
Referenced in: | [show references] |