Libraryless. Click here for Pure Java version (48L/1K).
1 | static simplyCached CharComparator ciCharComparator() {
|
2 | ret new ciCharComparator_C; |
3 | } |
4 | |
5 | final sclass ciCharComparator_C implements CharComparator {
|
6 | public int compare(char c1, char c2) {
|
7 | if (c1 == c2) ret 0; |
8 | c1 = Character.toUpperCase(c1); |
9 | c2 = Character.toUpperCase(c2); |
10 | if (c1 == c2) ret 0; |
11 | c1 = Character.toLowerCase(c1); |
12 | c2 = Character.toLowerCase(c2); |
13 | // No overflow because of numeric promotion |
14 | ret c1 - c2; |
15 | } |
16 | } |
Began life as a copy of #1014136
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1029548 |
| Snippet name: | ciCharComparator (same ordering as String.CASE_INSENSITIVE_ORDER) |
| Eternal ID of this version: | #1029548/4 |
| Text MD5: | 500c2d437bb8693fc47d806bbeb6b9dd |
| Transpilation MD5: | e8e71fa64dcab19a01dd25da33606c9d |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-08-23 09:34:49 |
| Source code size: | 469 bytes / 16 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 484 / 604 |
| Version history: | 3 change(s) |
| Referenced in: | [show references] |