From ef8c5e5bfa7e0808680758e43718e134cf4f5e91 Mon Sep 17 00:00:00 2001 From: SakshamGupta1995 <44345026+SakshamGupta1995@users.noreply.github.com> Date: Fri, 15 Mar 2019 12:19:06 +0530 Subject: [PATCH] Add equalsIgnoreCase to the file (#27662) The function equalsIgnoreCase() is also used for comparing the equality of 2 strings. --- guide/english/java/equality/index.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/guide/english/java/equality/index.md b/guide/english/java/equality/index.md index 6d07c7b415..d50afd3d09 100644 --- a/guide/english/java/equality/index.md +++ b/guide/english/java/equality/index.md @@ -64,5 +64,17 @@ For example, the `java.util.Set` interface specifies that a `Set`'s `equals()` m However, if a class does not override the default `equals()` implementation, the default implementation will apply, which simply uses the `==` operator to compare the two objects. +## The `.equalsIgnoreCase()` Method + +This built-in function in java is used to compare the equality of 2 strings return true or false depending on the match but this function does not see if the characters are in upper case or in lower case. +Example: + +```java +String s1="DEMO for Equality"; +String s2="Demo for equality"; +System.out.println(s1.equals(s2)); //false +System.out.println(s1.equalsIgnoreCase(s2)); //true +``` + #### More Information: - [Oracle Java Docs : Equality Operators](https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.21)