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

22
LINES

< > BotCompany Repo | #1000657 - indexOfIgnoreCase

JavaX fragment (include)

// works on lists and strings and null

static int indexOfIgnoreCase(L<S> a, S b) {
  ret indexOfIgnoreCase(a, b, 0);
}

static int indexOfIgnoreCase(L<S> a, S b, int i) {
  int n = a == null ? 0 : a.size();
  for (; i < n; i++)
    if (eqic(a.get(i), b)) ret i;
  ret -1;
}

static int indexOfIgnoreCase(S a, S b) {
  ret indexOfIgnoreCase_manual(a, b);
  /*Matcher m = Pattern.compile(b, Pattern.CASE_INSENSITIVE + Pattern.LITERAL).matcher(a);
  if (m.find()) return m.start(); else ret -1;*/
}

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

download  show line numbers  debug dex   

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

No comments. add comment

Snippet ID: #1000657
Snippet name: indexOfIgnoreCase
Eternal ID of this version: #1000657/12
Text MD5: 1de6fe550643ac229705217d708dd606
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:26
Source code size: 609 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 473 / 3068
Version history: 11 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1000657 & http://1000657.tinybrain.de