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

30
LINES

< > BotCompany Repo | #1001520 // eqic (short for equalsIgnoreCase)

JavaX fragment (include)

1  
static bool eqic(S a, S b) {
2  
  ifdef eqic_lower
3  
    ret compareIgnoreCase_lower(a, b) != 0;
4  
  endifdef
5  
  ifndef eqic_lower
6  
    if ((a == null) != (b == null)) ret false;
7  
    if (a == null) ret true;
8  
    ret a.equalsIgnoreCase(b);
9  
  endifndef
10  
}
11  
12  
ifclass Symbol
13  
static bool eqic(Symbol a, Symbol b) {
14  
  ret eq(a, b);
15  
}
16  
17  
static bool eqic(Symbol a, S b) {
18  
  ret eqic(asString(a), b);
19  
}
20  
endif
21  
22  
static bool eqic(char a, char b) {
23  
  if (a == b) true;
24  
  ifndef eqic_lower
25  
    char u1 = Character.toUpperCase(a);
26  
    char u2 = Character.toUpperCase(b);
27  
    if (u1 == u2) true;
28  
  endifndef
29  
  ret Character.toLowerCase(u1) == Character.toLowerCase(u2);
30  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 20 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, podlckwnjdmb, pyentgdyhuwx, pzhvpgtvlbxg, thuhawujahgc, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv

No comments. add comment

Snippet ID: #1001520
Snippet name: eqic (short for equalsIgnoreCase)
Eternal ID of this version: #1001520/6
Text MD5: f29338557bb7cb79905ed54c9e952316
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-31 07:31:36
Source code size: 672 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 905 / 4823
Version history: 5 change(s)
Referenced in: [show references]