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

6
LINES

< > BotCompany Repo | #1030752 // dropTrailingNewLine

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2841L/17K).

sS dropTrailingNewLine(S s) {
  int l = l(s);
  if (l > 0 && s.charAt(l-1) == '\n') --l;
  if (l > 0 && s.charAt(l-1) == '\r') --l;
  ret takeFirst(s, l);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030752
Snippet name: dropTrailingNewLine
Eternal ID of this version: #1030752/1
Text MD5: 9c7ff6f751d8f5047e69be08638e76a3
Transpilation MD5: 8a71c365a5236681a82a48e1df2f023e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-03-18 22:50:38
Source code size: 161 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 91 / 148
Referenced in: [show references]