1 | static LS splitByZeroIndent(S s) { |
2 | LS lines = lines(s); |
3 | new LS out; |
4 | int j = 0; |
5 | for i over lines: { |
6 | if (!startsWithSpace(lines.get(i))) { |
7 | if (i > j) |
8 | out.add(lines(subList(lines, j, i))); |
9 | j = i; |
10 | } |
11 | } |
12 | if (j < l(lines)) |
13 | out.add(lines(subList(lines, j))); |
14 | ret out; |
15 | } |
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: | 333 / 380 |
Version history: | 2 change(s) |
Referenced in: | [show references] |