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

19
LINES

< > BotCompany Repo | #1018056 // replaceVars_withDollarQ

JavaX fragment (include)

static S replaceVars_withDollarQ(S s, SS map) {
  ret empty(map) ? s : join(replaceVars_withDollarQ(javaTok(s), map));
}
  
static LS replaceVars_withDollarQ(LS tok, SS map) {
  if (empty(map)) ret tok;
  tok = cloneList(tok);
  for (int i = 1; i < l(tok); i +=2) {
    S t = tok.get(i);
    S value = map.get(t);
    if (value != null)
      tok.set(i, value);
    else if (t.startsWith("$_q_")) {
      value = map.get("$" + substring(t, 4));
      if (value != null) tok.set(i, quote(value));
    }
  }
  ret tok;
}

Author comment

Began life as a copy of #1004293

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018056
Snippet name: replaceVars_withDollarQ
Eternal ID of this version: #1018056/3
Text MD5: 2eb6a330296d107808bc8b36b18a2e65
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-08-29 00:26:11
Source code size: 536 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 346 / 389
Version history: 2 change(s)
Referenced in: [show references]