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

6
LINES

< > BotCompany Repo | #1022389 // startsWithEndsWith_getRest

JavaX fragment (include)

1  
sS startsWithEndsWith_getRest(S s, S prefix, S suffix) {
2  
  ret startsWith(s, prefix)
3  
    && endsWith(s, suffix)
4  
    && l(s) >= l(prefix)+l(suffix) ?
5  
      substring(s, l(prefix), l(s)-l(suffix)) : null;
6  
}

Author comment

Began life as a copy of #1014254

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022389
Snippet name: startsWithEndsWith_getRest
Eternal ID of this version: #1022389/1
Text MD5: 82bfb1082df80480648dc2a6e650f995
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-16 16:56:51
Source code size: 209 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 320 / 319
Referenced in: [show references]