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)

1  
static int indexOfIC_underscore(S a, S b) {
2  
  int la = l(a), lb = l(b);
3  
  if (la < lb) ret -1;
4  
  int n = la-lb;
5  
  
6  
  elsewhere: for (int i = 0; i <= n; i++) {
7  
    for (int j = 0; j < lb; j++) {
8  
      char c2 = b.charAt(j);
9  
      if (c2 == '_' || eqic(c2, a.charAt(i+j))) { /* matching char */ }
10  
      else continue elsewhere;
11  
    }
12  
    ret i;
13  
  }
14  
  ret -1;
15  
}

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: 436 / 816
Version history: 2 change(s)
Referenced in: [show references]