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

16
LINES

< > BotCompany Repo | #1018186 // splitAtSingleArrow - javaTok and split at "->" (and trim)

JavaX fragment (include)

1  
static L<S> splitAtSingleArrow(S s) {
2  
  ret splitAtSingleArrow(javaTok(s));
3  
}
4  
5  
static L<S> splitAtSingleArrow(L<S> tok) {
6  
  new L<S> l;
7  
  int i = 0;
8  
  while (i < l(tok)) {
9  
    int j = indexOfSubList(tok, ll("-", "", ">"), i);
10  
    if (i >= l(tok)) break;
11  
    if (j < 0) j = l(tok);
12  
    l.add(trimJoin(tok.subList(i, j)));
13  
    i = j+3;
14  
  }
15  
  ret l;
16  
}

Author comment

Began life as a copy of #1011989

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018186
Snippet name: splitAtSingleArrow - javaTok and split at "->" (and trim)
Eternal ID of this version: #1018186/1
Text MD5: 541f703c9b25b19f46f5d03a302215d3
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-07 20:06:00
Source code size: 363 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 318 / 360
Referenced in: [show references]