public static String rtrim(String s) {
int i = s.length();
while (i > 0 && (s.charAt(i-1) == ' ' || s.charAt(i-1) == '\t'))
--i;
return i < s.length() ? s.substring(0, i) : s;
}Snippet is not live.
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #2000477 |
| Snippet name: | rtrim |
| Eternal ID of this version: | #2000477/1 |
| Text MD5: | 9e2d3cefc334daeedc1c75b37158ecfc |
| Author: | stefan |
| Category: | |
| Type: | New Tinybrain snippet |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2015-08-01 18:41:32 |
| Source code size: | 192 bytes / 6 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 869 / 241 |
| Referenced in: | #1001543 - ltrim #1001561 - rtrim (now includes line breaks) #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |