Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

7
LINES

< > BotCompany Repo | #1001561 // rtrim (now includes line breaks)

JavaX fragment (include)

public static String rtrim(String s) {
  if (s == null) null;
  int i = s.length();
  while (i > 0 && " \t\r\n".indexOf(s.charAt(i-1)) >= 0)
    --i;
  return i < s.length() ? s.substring(0, i) : s;
}

Author comment

Began life as a copy of #2000477

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001561
Snippet name: rtrim (now includes line breaks)
Eternal ID of this version: #1001561/2
Text MD5: 5368c993296c9c12cbcf259991876dda
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-17 16:56:15
Source code size: 206 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 836 / 2873
Version history: 1 change(s)
Referenced in: #1002427 - Accellerating 629 (SPIKE)
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1015065 - rtrimSpaces (and tabs, but no line breaks)
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)