1 | static int betterGetIndent(S s) { |
2 | int n = Int.MAX_VALUE; |
3 | for (line : linesIterator(s)) { |
4 | line = rtrim(line); |
5 | if (nempty(line)) { |
6 | int indent = getIndentOfLine(line); |
7 | if (indent < n) { |
8 | n = indent; |
9 | if (n == 0) ret 0; |
10 | } |
11 | } |
12 | } |
13 | ret n; |
14 | } |
Began life as a copy of #1002854
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj
No comments. add comment
Snippet ID: | #1036936 |
Snippet name: | betterGetIndent - getIndent + handling empty lines better |
Eternal ID of this version: | #1036936/5 |
Text MD5: | d85d61e1fdad3ad0fb439267bddd776b |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2023-07-24 21:33:56 |
Source code size: | 297 bytes / 14 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 118 / 157 |
Version history: | 4 change(s) |
Referenced in: | [show references] |