Libraryless. Click here for Pure Java version (3017L/18K).
1 | // line starts at 1 |
2 | svoid printLineWithContext(S text, int line) {
|
3 | print(); |
4 | L<S> lines = lines(text); |
5 | for (int i = max(1, line-5); i <= min(l(lines), line+5); i++) |
6 | print((i == line ? "* " : " ") + "LINE " + i + ": " + lines.get(i-1)); |
7 | print(); |
8 | } |
Began life as a copy of #1015769
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1031181 |
| Snippet name: | printLineWithContext |
| Eternal ID of this version: | #1031181/4 |
| Text MD5: | 98acaa61982702cdea66c0ac83facd66 |
| Transpilation MD5: | da7b0cfbe6b3537210b6d3e6f6c0d0f6 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-05-19 19:41:32 |
| Source code size: | 265 bytes / 8 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 408 / 507 |
| Version history: | 3 change(s) |
| Referenced in: | [show references] |