Home

StringequalsIgnoreCase

StringequalsIgnoreCase refers to a method in Java’s String class, commonly written as equalsIgnoreCase. It performs a case-insensitive comparison of the invoking string with another string. The method returns true when both strings represent the same characters in the same order, ignoring differences in case, and false otherwise. It is widely used for user input matching, command parsing, and similar tasks where exact case should not affect equality.

In Java, equalsIgnoreCase has the signature public boolean equalsIgnoreCase(String anotherString). If anotherString is null, the method

Note that equalsIgnoreCase is locale-insensitive and is not affected by the default locale. It does not support

Example: String a = "Hello"; String b = "hello"; boolean same = a.equalsIgnoreCase(b); // true

returns
false.
The
comparison
proceeds
by
evaluating
each
corresponding
character
pair
according
to
Unicode
case
mappings;
the
method
does
not
use
locale-specific
rules.
If
the
strings
have
different
lengths,
the
result
is
false.
For
performance,
the
method
includes
optimizations
for
common
ASCII
cases,
but
in
general
it
may
be
slower
than
a
simple
equals
followed
by
a
case-normalization
step
for
many
characters.
locale-aware
case
folding
like
some
languages
require;
for
locale-sensitive
comparisons,
developers
can
use
alternatives
such
as
Collator
with
a
specific
Locale
or
convert
strings
using
a
Locale-aware
approach
before
comparing.