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

15
LINES

< > BotCompany Repo | #1014502 // indexOfIC_underscore - indexOfIC + underscore as single character wildcard (as in MySQL)

JavaX fragment (include)

static int indexOfIC_underscore(S a, S b) {
  int la = l(a), lb = l(b);
  if (la < lb) ret -1;
  int n = la-lb;
  
  elsewhere: for (int i = 0; i <= n; i++) {
    for (int j = 0; j < lb; j++) {
      char c2 = b.charAt(j);
      if (c2 == '_' || eqic(c2, a.charAt(i+j))) { /* matching char */ }
      else continue elsewhere;
    }
    ret i;
  }
  ret -1;
}

Author comment

Began life as a copy of #1011046

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1014502
Snippet name: indexOfIC_underscore - indexOfIC + underscore as single character wildcard (as in MySQL)
Eternal ID of this version: #1014502/3
Text MD5: e5ab722a975f65e221fa59e4c6ef9933
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-22 17:05:08
Source code size: 372 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 437 / 816
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)