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).

static <A> S replaceVars(S s, Map<S, A> map) {
  ret empty(map) ? s : join(replaceVars(javaTok(s), map));
}
  
static <A> LS replaceVars(LS tok, Map<S, A> map) {
  if (empty(map)) ret tok;
  tok = cloneList(tok);
  for (S var, O val : map)
    jreplace(tok, var, str(val));
  ret tok;
}

sS replaceVars(S s, O... params) {
  ret replaceVars(s, paramsToMap(params));
}

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: 753 / 839
Version history: 6 change(s)
Referenced in: [show references]