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

19
LINES

< > BotCompany Repo | #1017693 // dollarVarsToStars_underscores

JavaX fragment (include)

static S dollarVarsToStars_underscores(S s) {
  ret dollarVarsToStars_underscores(s, null);
}

static S dollarVarsToStars_underscores(S s, L<S> varNames_out) {
  ret join(dollarVarsToStars_underscores(javaTok(s), varNames_out));
}

static L<S> dollarVarsToStars_underscores(L<S> tok, L<S> varNames_out) {
  for (int i = 1; i < l(tok); i += 2) {
    S t = tok.get(i);
    if (isDollarVar(t)) {
      listAdd(varNames_out, t);
      tok.set(i, joinWithSpace(rep("*", underscoreWordCount(t))));
    } else if (eq(t, "*"))
      listAdd(varNames_out, "*");
  }
  ret tok;
}

Author comment

Began life as a copy of #1010854

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1017693
Snippet name: dollarVarsToStars_underscores
Eternal ID of this version: #1017693/3
Text MD5: 78d681c12a55cabbfabaaa26b116f385
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-08-17 13:04:23
Source code size: 589 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 488 / 508
Version history: 2 change(s)
Referenced in: [show references]