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

18
LINES

< > BotCompany Repo | #1012719 // lowerCaseCompare

JavaX fragment (include)

1  
static int lowerCaseCompare(S a, S b) {
2  
  if (a == null) ret b == null ? 0 : -1;
3  
  if (b == null) ret 1;
4  
  
5  
  int len1 = a.length();
6  
  int len2 = b.length();
7  
  int lim = Math.min(len1, len2);
8  
9  
  int k = 0;
10  
  while (k < lim) {
11  
    char c1 = Character.toLowerCase(a.charAt(k));
12  
    char c2 = Character.toLowerCase(b.charAt(k));
13  
    if (c1 != c2)
14  
      ret c1 - c2;
15  
    k++;
16  
  }
17  
  ret len1 - len2;
18  
}

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: #1012719
Snippet name: lowerCaseCompare
Eternal ID of this version: #1012719/2
Text MD5: 77f27a5695ca22121ed4d99ac919c0d2
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-10 22:01:46
Source code size: 415 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 403 / 426
Version history: 1 change(s)
Referenced in: [show references]