Libraryless. Click here for Pure Java version (55L/1K).
static S substring(S s, int x) { ret substring(s, x, strL(s)); } static S substring(S s, int x, int y) { if (s == null) return null; if (x < 0) x = 0; int n = s.length(); if (y < x) y = x; if (y > n) y = n; if (x >= y) ret ""; return s.substring(x, y); } ifclass IntRange static S substring(S s, IntRange r) { ret r == null ? null : substring(s, r.start, r.end); } endif // convenience method for quickly dropping a prefix sS substring(S s, CharSequence l) { ret substring(s, lCharSequence(l)); }
Began life as a copy of #1001853
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1002637 |
Snippet name: | substring - exception-free (safe) version of String.substring |
Eternal ID of this version: | #1002637/14 |
Text MD5: | 4bd5f88c94b2e6c19242cf331151bba1 |
Transpilation MD5: | 46704d4744af4e00e5e182bab6ca5db8 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-05-06 16:11:54 |
Source code size: | 542 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 918 / 2199 |
Version history: | 13 change(s) |
Referenced in: | [show references] |