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)

static bool eqic(S a, S b) {
  ifdef eqic_lower
    ret compareIgnoreCase_lower(a, b) != 0;
  endifdef
  ifndef eqic_lower
    if ((a == null) != (b == null)) ret false;
    if (a == null) ret true;
    ret a.equalsIgnoreCase(b);
  endifndef
}

ifclass Symbol
static bool eqic(Symbol a, Symbol b) {
  ret eq(a, b);
}

static bool eqic(Symbol a, S b) {
  ret eqic(asString(a), b);
}
endif

static bool eqic(char a, char b) {
  if (a == b) true;
  ifndef eqic_lower
    char u1 = Character.toUpperCase(a);
    char u2 = Character.toUpperCase(b);
    if (u1 == u2) true;
  endifndef
  ret Character.toLowerCase(u1) == Character.toLowerCase(u2);
}

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: 899 / 4814
Version history: 5 change(s)
Referenced in: #1002427 - Accellerating 629 (SPIKE)
#1005461 - neqic (!equalsIgnoreCase)
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1030089 - eqic_unnull
#3000382 - Answer for ferdie (>> t = 1, f = 0)