Libraryless. Click here for Pure Java version (2495L/16K).
1 | sS rtrimAllLines(S s) { |
2 | new StringBuilder buf; |
3 | int n = l(s); |
4 | for (int i = 0; i < n; ) { |
5 | int j = i; |
6 | while (j < n && isSpaceOrTab(s.charAt(j))) ++j; |
7 | if (i == j) |
8 | buf.append(s.charAt(i++)); |
9 | else { |
10 | if (j < n && !isNewLine(s.charAt(j))) |
11 | buf.append(substring(s, i, j)); |
12 | i = j; |
13 | } |
14 | } |
15 | ret str(buf); |
16 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1028285 |
Snippet name: | rtrimAllLines - more precise version of rtrimAll |
Eternal ID of this version: | #1028285/6 |
Text MD5: | dd6022bdc0d303f8f0f7bdd2f669312d |
Transpilation MD5: | fbe632732aa1eecc029ba99ceba92e1d |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-06-07 18:51:31 |
Source code size: | 360 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 178 / 276 |
Version history: | 5 change(s) |
Referenced in: | [show references] |