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

20
LINES

< > BotCompany Repo | #1008048 // cicFast - faster containsIgnoreCase (for strings)

JavaX fragment (include)

1  
static bool cicFast(S src, S what) {
2  
  final int length = what.length();
3  
  if (length == 0)
4  
    true;
5  
6  
  final char c = what.charAt(0);
7  
  final char firstLo = Character.toLowerCase(c);
8  
  final char firstUp = Character.toUpperCase(c);
9  
10  
  for (int i = src.length() - length; i >= 0; i--) {
11  
    final char ch = src.charAt(i);
12  
    if (ch != firstLo && ch != firstUp)
13  
      continue;
14  
15  
    if (src.regionMatches(true, i, what, 0, length))
16  
      true;
17  
  }
18  
19  
  false;
20  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1008048
Snippet name: cicFast - faster containsIgnoreCase (for strings)
Eternal ID of this version: #1008048/1
Text MD5: 9f9d88c2be8361b8825de8e9e455d6eb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-04-22 15:31:50
Source code size: 479 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 466 / 489
Referenced in: [show references]