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

14
LINES

< > BotCompany Repo | #1003360 - splitAtEmptyLines - also covers lines containing spaces

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2738L/17K).

static L<S> splitAtEmptyLines(S text) {
  L<S> lines = toLines(text);
  int n = l(lines), i = 0;
  new L<S> parts;
  while ping (true) {
    while (i < n && emptyAfterTrim(lines.get(i))) ++i;
    if (i >= n) break;
    int j = i;
    while (j < n && !emptyAfterTrim(lines.get(j))) ++j;
    parts.add(fromLines(subList(lines, i, j)));
    i = j;
  }
  ret parts;
}

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, xrpafgyirdlv

No comments. add comment

Snippet ID: #1003360
Snippet name: splitAtEmptyLines - also covers lines containing spaces
Eternal ID of this version: #1003360/3
Text MD5: 495efd68ec9496749f7515dddd7684ae
Transpilation MD5: 5a99d8f55c758aaca57ce287df324892
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-18 11:35:13
Source code size: 376 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 512 / 518
Version history: 2 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1003360 & http://1003360.tinybrain.de