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).

static CharSequence subCharSequence(CharSequence s, int x) {
  ret subCharSequence(s, x, s == null ? 0 : s.length());
}

static CharSequence subCharSequence(CharSequence s, int x, int y) {
  if (s == null) null;
  if (x < 0) x = 0;
  if (x >= s.length()) return "";
  if (y < x) y = x;
  if (y > s.length()) y = s.length();
  ret s.subSequence(x, y);
}

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: 281 / 389
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)