static S commonPrefixCI(S a, S b) { int i = 0, nb = b.length(), na = a.length(), n = min(na, nb); while (i < n && eqic(a.charAt(i), b.charAt(i))) ++i; return i == nb ? b : substring(a, 0, i); } static S commonPrefixCI(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 = commonPrefixCI(s, l.get(i)); } ret s; }
Began life as a copy of #1013590
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: | #1014380 |
| Snippet name: | commonPrefixCI |
| Eternal ID of this version: | #1014380/4 |
| Text MD5: | 1cfd7e70f20eb536b48e0449fc308693 |
| 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:31:09 |
| Source code size: | 407 bytes / 16 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 571 / 619 |
| Version history: | 3 change(s) |
| Referenced in: | [show references] |