Libraryless. Click here for Pure Java version (2205L/14K).
sclass StringBuilderWithIndent { new StringBuilder buf; S indent = ""; void println(O o) { buf.append(indentx(indent, o + "\n")); } AutoCloseable indent() { S oldIndent = indent; indent += " "; ret autoCloseable { indent = oldIndent; }; } //void unindent() { indent = dropLast(2, indent); } toString { ret str(buf); } }
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1026306 |
Snippet name: | StringBuilderWithIndent |
Eternal ID of this version: | #1026306/4 |
Text MD5: | 066c6c8fd01635982e6e3f31c5fd14e5 |
Transpilation MD5: | 6d227c61ac38eda9128c9be9c39df2f5 |
Author: | stefan |
Category: | javax / discord |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-12-15 17:12:56 |
Source code size: | 381 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 187 / 548 |
Version history: | 3 change(s) |
Referenced in: | [show references] |