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

12
LINES

< > BotCompany Repo | #1028133 // subCharSequence

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

Libraryless. Click here for Pure Java version (37L/1K).

1  
static CharSequence subCharSequence(CharSequence s, int x) {
2  
  ret subCharSequence(s, x, s == null ? 0 : s.length());
3  
}
4  
5  
static CharSequence subCharSequence(CharSequence s, int x, int y) {
6  
  if (s == null) null;
7  
  if (x < 0) x = 0;
8  
  if (x >= s.length()) return "";
9  
  if (y < x) y = x;
10  
  if (y > s.length()) y = s.length();
11  
  ret s.subSequence(x, y);
12  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1028133
Snippet name: subCharSequence
Eternal ID of this version: #1028133/1
Text MD5: 2378b06865bd745a9b495cc67219a6b9
Transpilation MD5: b9bd9a76693fc83f73ff5f4de14ea64e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-05-23 12:25:24
Source code size: 363 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 280 / 388
Referenced in: [show references]