Libraryless. Click here for Pure Java version (2712L/17K).
// leaves lines enclosed in brackets alone sS autoUnindent_honoringBrackets(S s) { LS l = lines_honoringBrackets(s); if (empty(l)) ret s; // find indent int n = Integer.MAX_VALUE; for (S line : l) n = min(n, getIndentOfLine(line)); if (n == 0) ret s; // unindent int _n = n; ret lines_possiblyRTrim(s, map(l, line -> substring(line, _n)); }
Began life as a copy of #1002853
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: | #1025780 |
Snippet name: | autoUnindent_honoringBrackets |
Eternal ID of this version: | #1025780/5 |
Text MD5: | 5dc104b86acb9728f73280e8b034dc41 |
Transpilation MD5: | 901a4eae40b23b6e3425c3f641870c49 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-10-19 16:10:54 |
Source code size: | 382 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 227 / 334 |
Version history: | 4 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |