Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

15
LINES

< > BotCompany Repo | #1004293 // replaceVars - uses javaTok

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3527L/21K).

1  
static <A> S replaceVars(S s, Map<S, A> map) {
2  
  ret empty(map) ? s : join(replaceVars(javaTok(s), map));
3  
}
4  
  
5  
static <A> LS replaceVars(LS tok, Map<S, A> map) {
6  
  if (empty(map)) ret tok;
7  
  tok = cloneList(tok);
8  
  for (S var, O val : map)
9  
    jreplace(tok, var, str(val));
10  
  ret tok;
11  
}
12  
13  
sS replaceVars(S s, O... params) {
14  
  ret replaceVars(s, paramsToMap(params));
15  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1004293
Snippet name: replaceVars - uses javaTok
Eternal ID of this version: #1004293/7
Text MD5: f5bfa1e73f6eff2b9fe7c20a0443dd24
Transpilation MD5: 8e9a0b004b205412c3af862369f09659
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-04-03 16:51:14
Source code size: 381 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 755 / 842
Version history: 6 change(s)
Referenced in: [show references]