1 | // returns l(s) if not found |
2 | static int xIndexOf(S s, S sub, int i) {
|
3 | if (s == null) ret 0; |
4 | i = s.indexOf(sub, min(i, l(s))); |
5 | ret i >= 0 ? i : l(s); |
6 | } |
7 | |
8 | static int xIndexOf(S s, S sub) {
|
9 | ret xIndexOf(s, sub, 0); |
10 | } |
11 | |
12 | static int xIndexOf(S s, char c) {
|
13 | if (s == null) ret 0; |
14 | int i = s.indexOf(c); |
15 | ret i >= 0 ? i : l(s); |
16 | } |
Began life as a copy of #1002497
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1004805 |
| Snippet name: | xIndexOf - returns l(s) if not found [quasi synonym of smartIndexOf] |
| Eternal ID of this version: | #1004805/1 |
| Text MD5: | 66d69b8841fc67bf33b3870f8f8c6a9f |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2016-08-31 18:54:02 |
| Source code size: | 346 bytes / 16 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 852 / 1747 |
| Referenced in: | [show references] |