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

5
LINES

< > BotCompany Repo | #1035036 // dropAfterLastSlashOrEmpty - also drops the slash

JavaX fragment (include)

1  
sS dropAfterLastSlashOrEmpty(S s) {
2  
  if (s == null) null;
3  
  int i = s.lastIndexOf('/');
4  
  ret i < 0 ? "" : rtrim(substring(s, 0, i));
5  
}

Author comment

Began life as a copy of #1007058

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035036
Snippet name: dropAfterLastSlashOrEmpty - also drops the slash
Eternal ID of this version: #1035036/1
Text MD5: 7ec22c54b12b510f885a94ae06c7d0c6
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-25 18:34:27
Source code size: 140 bytes / 5 lines
Pitched / IR pitched: No / No
Views / Downloads: 133 / 154
Referenced in: [show references]