Libraryless. Click here for Pure Java version (2506L/16K).
1 | sclass _PrintIndent extends F1<S, Bool> { |
2 | S prefix; |
3 | bool beginningOfLine = true; |
4 | |
5 | *() {} |
6 | *(S *prefix) {} |
7 | |
8 | Bool get(S s) { |
9 | if (empty(s)) false; |
10 | bool nl = s.endsWith("\n"); |
11 | if (nl) s = dropLast(s); |
12 | s = s.replace("\n", "\n" + prefix); |
13 | print_raw(beginningOfLine ? prefix + s : s); |
14 | if (nl) print_raw("\n"); |
15 | beginningOfLine = nl; |
16 | false; |
17 | } |
18 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1008514 |
Snippet name: | _PrintIndent |
Eternal ID of this version: | #1008514/4 |
Text MD5: | 194c8ef2a4cce849d4a1279c6dd11a92 |
Transpilation MD5: | d09ecb84eb57346170d94a76dbff4877 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-09-18 19:02:33 |
Source code size: | 399 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 661 / 1317 |
Version history: | 3 change(s) |
Referenced in: | [show references] |