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

12
LINES

< > BotCompany Repo | #1014353 // simpleEmptyLines - convert multiple empty lines to just one

JavaX fragment (include)

static S simpleEmptyLines(S s) {
  if (s == null) null;
  new L<S> l;
  bool lastEmpty = false;
  for (S line : lines(s)) {
    if (!emptyAfterTrim(line)) lastEmpty = false;
    else if (lastEmpty) continue;
    else lastEmpty = true;
    l.add(line);
  }
  ret lines(l);
}

Author comment

Began life as a copy of #1013676

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1014353
Snippet name: simpleEmptyLines - convert multiple empty lines to just one
Eternal ID of this version: #1014353/4
Text MD5: 153200a411b18674781a4fbb78b8bc17
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-08-31 13:27:54
Source code size: 284 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 397 / 409
Version history: 3 change(s)
Referenced in: [show references]