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   

Travelled to 14 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, podlckwnjdmb, thuhawujahgc, tslmcundralx, tvejysmllsmz, whxojlpjdney

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: 469 / 3715
Version history: 5 change(s)
Referenced in: [show references]