Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

19
LINES

< > BotCompany Repo | #1013296 // indexOfIgnoreCase_manual - probably faster than using regular expressions

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (88L/1K).

static int indexOfIgnoreCase_manual(S a, S b) {
  ret indexOfIgnoreCase_manual(a, b, 0);
}

static int indexOfIgnoreCase_manual(S a, S b, int i) {
  int la = strL(a), lb = strL(b);
  if (la < lb) ret -1;
  int n = la-lb;
  
  loop: for (; i <= n; i++) {
    for (int j = 0; j < lb; j++) {
      char c1 = a.charAt(i+j), c2 = b.charAt(j);
      if (!eqic(c1, c2))
        continue loop;
    }
    ret i;
  }
  ret -1;
}

Author comment

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: 479 / 715
Version history: 5 change(s)
Referenced in: [show references]