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

13
LINES

< > BotCompany Repo | #1003804 // splitAtDashLines - split at lines containing only dashes ("-"), one is enough

JavaX fragment (include)

1  
static L<S> splitAtDashLines(S text) {
2  
  L<S> lines = toLines(text);
3  
  new L<S> l;
4  
  int i = 0;
5  
  while (i < l(lines)) {
6  
    int j = indexOfDashLine(lines, i);
7  
    if (j < 0) j = l(lines);
8  
    if (j > i)
9  
      l.add(joinLines(lines.subList(i, j)));
10  
    i = j+1;
11  
  }
12  
  ret l;
13  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1003804
Snippet name: splitAtDashLines - split at lines containing only dashes ("-"), one is enough
Eternal ID of this version: #1003804/4
Text MD5: 7463cd11669cb11c75065b27678491aa
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-02 11:16:35
Source code size: 288 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 475 / 497
Version history: 3 change(s)
Referenced in: [show references]