String.equalsIgnoreCase — case-insensitive comparison
String.equalsIgnoreCase compares strings without distinguishing letter case, independently of locale. It returns boolean.
CKTIS / Java
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
String.equalsIgnoreCase compares strings without distinguishing letter case, independently of locale. It returns boolean.
String.format builds text from a format string and arguments using specifiers such as %s, %d, and %.2f. An explicit Locale makes numeric formatting independent of the environment's default locale settings.
String.hashCode returns an int hash code calculated from a string's contents. Equal strings have equal hashes, but matching hashes do not prove that strings are equal.
String.indexOf returns the position of the first substring match or -1. The fromIndex parameter lets you start searching at a specified position.
Learn why two strings with the same contents can be different objects, how `intern()` selects a canonical object, and what `length()` actually counts.
String.isBlank checks whether a string is empty or contains only whitespace as defined by Character.isWhitespace(int). It returns boolean and has been available since Java 11.
String.isEmpty() checks whether a string has length zero. It does not treat spaces as empty text and requires a non-null reference; use isBlank() to check for empty text or text consisting only of whitespace.
String.join builds text from elements separated by a delimiter. It accepts an Iterable or varargs arguments.
StringJoiner builds text with a delimiter, prefix, and suffix. merge preserves the incoming content's internal delimiter.
String.length() returns the number of UTF-16 code units, not necessarily the number of user-visible characters.
Test whether an entire string matches a regular expression. Learn how `(?s)` changes the dot, which character classes default to ASCII, and how to write regex backslashes in Java string literals.
String.replace replaces all literal matches without regular expressions. It returns the result without changing the original.
Replace every match of a regular expression. The example masks values in one specific password-argument format without changing the inputs.
String.split returns an array of text fragments separated by regular-expression matches. The limit parameter controls the number of splits and the treatment of trailing empty elements.
String.startsWith checks whether a string begins with a given prefix, optionally at a specified index.
String.substring returns part of a string without changing the original. The start is inclusive and the end exclusive; indices count UTF-16 code units.
String.toLowerCase returns lowercase text. The choice of Locale affects the result; use Locale.ROOT for language-independent text.
String.toUpperCase returns uppercase text. The chosen Locale affects the result; Locale.ROOT provides language-neutral rules.
String.trim removes characters with values no greater than U+0020 from both ends, leaving the interior unchanged.
This method returns the text `"null"` for a null reference and delegates to the object's `toString()` otherwise. That rule applies to the `Object` overload.
SynchronousQueue transfers an element directly between threads. Its put and take operations wait for a matching partner rather than using a buffer.
System.arraycopy copies elements into an existing array, supporting overlapping ranges while requiring compatible types and valid bounds.
System.identityHashCode returns an object's identity-based hash code, bypassing an overridden hashCode() method. It returns 0 for null. The result is not a unique identifier and does not replace reference comparison with ==.
System.lineSeparator() returns the system-dependent line separator. Use it when building text with native line endings, but not instead of a separator required by a data format.