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

15
LINES

< > BotCompany Repo | #1011989 // splitAtDoubleArrow - javaTok and split at "=>" (and trim)

JavaX fragment (include)

static L<S> splitAtDoubleArrow(S s) {
  ret splitAtDoubleArrow(javaTok(s));
}

static L<S> splitAtDoubleArrow(L<S> tok) {
  new L<S> l;
  int i = 0;
  while (i < l(tok)) {
    int j = indexOfSubList(tok, splitAtDoubleArrow_tok(), i);
    if (j < 0) j = l(tok);
    l.add(trimJoin(tok.subList(i, j)));
    i = j+3;
  }
  ret l;
}

Author comment

Began life as a copy of #1008581

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1011989
Snippet name: splitAtDoubleArrow - javaTok and split at "=>" (and trim)
Eternal ID of this version: #1011989/9
Text MD5: 95ab7e0df7a5b0a764e94349043787d0
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-20 21:07:47
Source code size: 342 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 582 / 613
Version history: 8 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1012882 - tok_splitAtSlash - javaTok and split at "/" (and trim)
#1014234 - splitAtDoubleArrow_bothDirections - javaTok and split at "=>" (and trim) or "<=" (and reverse)
#1014235 - splitAtDoubleLeftArrow - javaTok and split at "<=" (and trim)
#1017544 - splitAtTokens
#1018186 - splitAtSingleArrow - javaTok and split at "->" (and trim)
#1021252 - splitAtDoubleArrow_pair - javaTok and split at "=>" (and trim). uses javaTokWithBrackets
#1022793 - splitAtDoubleArrow_tok
#1025939 - splitAtFirstDoubleArrow - javaTok and split at "=>" (and trim)