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

16
LINES

< > BotCompany Repo | #1008581 // splitAtSimpleArrow - javaTok and split at "->"

JavaX fragment (include)

1  
static L<S> splitAtSimpleArrow(S s) {
2  
  ret splitAtSimpleArrow(javaTok(s));
3  
}
4  
5  
static L<S> splitAtSimpleArrow(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 #1005258

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1008581
Snippet name: splitAtSimpleArrow - javaTok and split at "->"
Eternal ID of this version: #1008581/5
Text MD5: 2f6545dd97fd23db10376617d5ebc045
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-14 05:01:02
Source code size: 363 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 574 / 604
Version history: 4 change(s)
Referenced in: [show references]