Libraryless. Click here for Pure Java version (2651L/17K).
1 | sS joinAdjacentTokensIf(S s, IF2<S, S, Bool> pred) { |
2 | LS tok = javaTok(s); |
3 | new LS out; |
4 | for (int i = 3; i < l(tok); i += 2) |
5 | if (nempty(tok.get(i-1)) && pred.get(tok.get(i-2), tok.get(i))) |
6 | tok.set(i-1, ""); |
7 | ret join(tok); |
8 | } |
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: | 200 / 285 |
Referenced in: | [show references] |