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

15
LINES

< > BotCompany Repo | #1020395 // splitByZeroIndent - e.g. for output of pactl

JavaX fragment (include)

static LS splitByZeroIndent(S s) {
  LS lines = lines(s);
  new LS out;
  int j = 0;
  for i over lines: {
    if (!startsWithSpace(lines.get(i))) {
      if (i > j)
        out.add(lines(subList(lines, j, i)));
      j = i;
    }
  }
  if (j < l(lines))
    out.add(lines(subList(lines, j)));
  ret out;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020395
Snippet name: splitByZeroIndent - e.g. for output of pactl
Eternal ID of this version: #1020395/3
Text MD5: 0871f220665c031159986e118f65c929
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-18 23:57:36
Source code size: 320 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 264 / 307
Version history: 2 change(s)
Referenced in: [show references]