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   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, 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: 46 / 69
Referenced in: [show references]

Formerly at http://tinybrain.de/1028133 & http://1028133.tinybrain.de