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)

static bool cicFast(S src, S what) {
  final int length = what.length();
  if (length == 0)
    true;

  final char c = what.charAt(0);
  final char firstLo = Character.toLowerCase(c);
  final char firstUp = Character.toUpperCase(c);

  for (int i = src.length() - length; i >= 0; i--) {
    final char ch = src.charAt(i);
    if (ch != firstLo && ch != firstUp)
      continue;

    if (src.regionMatches(true, i, what, 0, length))
      true;
  }

  false;
}

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: 538 / 560
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)