1 | static int compareIgnoreCase_jdk(S s1, S s2) { |
2 | if (s1 == null) ret s2 == null ? 0 : -1; |
3 | if (s2 == null) ret 1; |
4 | |
5 | int n1 = s1.length(); |
6 | int n2 = s2.length(); |
7 | int min = Math.min(n1, n2); |
8 | for (int i = 0; i < min; i++) { |
9 | char c1 = s1.charAt(i); |
10 | char c2 = s2.charAt(i); |
11 | if (c1 != c2) { |
12 | c1 = Character.toUpperCase(c1); |
13 | c2 = Character.toUpperCase(c2); |
14 | if (c1 != c2) { |
15 | c1 = Character.toLowerCase(c1); |
16 | c2 = Character.toLowerCase(c2); |
17 | if (c1 != c2) ret c1-c2; |
18 | } |
19 | } |
20 | } |
21 | ret n1-n2; |
22 | } |
Began life as a copy of #1013287
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: | #1013295 |
Snippet name: | compareIgnoreCase_jdk - uses standard JDK method |
Eternal ID of this version: | #1013295/1 |
Text MD5: | da0c1dc03038c6c5c79e1f986355c880 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-12-31 08:10:51 |
Source code size: | 568 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 420 / 653 |
Referenced in: | [show references] |