Libraryless. Click here for Pure Java version (2495L/16K).
sS rtrimAllLines(S s) { new StringBuilder buf; int n = l(s); for (int i = 0; i < n; ) { int j = i; while (j < n && isSpaceOrTab(s.charAt(j))) ++j; if (i == j) buf.append(s.charAt(i++)); else { if (j < n && !isNewLine(s.charAt(j))) buf.append(substring(s, i, j)); i = j; } } ret str(buf); }
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: | 177 / 275 |
Version history: | 5 change(s) |
Referenced in: | [show references] |