Libraryless. Click here for Pure Java version (88L/1K).
1 | static int indexOfIgnoreCase_manual(S a, S b) { |
2 | ret indexOfIgnoreCase_manual(a, b, 0); |
3 | } |
4 | |
5 | static int indexOfIgnoreCase_manual(S a, S b, int i) { |
6 | int la = strL(a), lb = strL(b); |
7 | if (la < lb) ret -1; |
8 | int n = la-lb; |
9 | |
10 | loop: for (; i <= n; i++) { |
11 | for (int j = 0; j < lb; j++) { |
12 | char c1 = a.charAt(i+j), c2 = b.charAt(j); |
13 | if (!eqic(c1, c2)) |
14 | continue loop; |
15 | } |
16 | ret i; |
17 | } |
18 | ret -1; |
19 | } |
Began life as a copy of #1000657
download show line numbers debug dex old transpilations
Travelled to 18 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lnbujpyubztb, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1013296 |
Snippet name: | indexOfIgnoreCase_manual - probably faster than using regular expressions |
Eternal ID of this version: | #1013296/6 |
Text MD5: | b6f2daf974dd71f0042a54a522311590 |
Transpilation MD5: | 879ec00f0e141885f22dba949b68a714 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-07-12 20:32:50 |
Source code size: | 436 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 560 / 816 |
Version history: | 5 change(s) |
Referenced in: | [show references] |