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

16
LINES

< > BotCompany Repo | #1014381 // commonPrefixCI

JavaX fragment (include)

static S commonSuffixCI(S a, S b) {
  int i = 0, nb = b.length(), na = a.length(), n = min(na, nb);
  while (i < n && eqic(a.charAt(na-1-i), b.charAt(nb-1-i)))
    ++i;
  return i == nb ? b : substring(a, na-i);
}

static S commonSuffixCI(L<S> l) {
  if (empty(l)) ret "";
  S s = first(l);
  for (int i = 1; i < l(l); i++) {
    if (empty(s)) ret s;
    s = commonSuffixCI(s, l.get(i));
  }
  ret s;
}

Author comment

Began life as a copy of #1014380

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1014381
Snippet name: commonPrefixCI
Eternal ID of this version: #1014381/1
Text MD5: 62136beacd2256ff3e324e738322d137
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-20 17:34:35
Source code size: 417 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 300 / 343
Referenced in: [show references]