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

8
LINES

< > BotCompany Repo | #1028939 // joinAdjacentTokensIf

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

Libraryless. Click here for Pure Java version (2651L/17K).

sS joinAdjacentTokensIf(S s, IF2<S, S, Bool> pred) {
  LS tok = javaTok(s);
  new LS out;
  for (int i = 3; i < l(tok); i += 2)
    if (nempty(tok.get(i-1)) && pred.get(tok.get(i-2), tok.get(i)))
      tok.set(i-1, "");
  ret join(tok);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028939
Snippet name: joinAdjacentTokensIf
Eternal ID of this version: #1028939/1
Text MD5: c30a17c554b475e263f6619c524bd69f
Transpilation MD5: e27eb7a4ece4750020fe274910a89e16
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-12 13:03:10
Source code size: 245 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 197 / 279
Referenced in: [show references]