Java String Equal areStringsEqual(String s1, String s2, boolean caseInsensitive)

Here you can find the source of areStringsEqual(String s1, String s2, boolean caseInsensitive)

Description

are Strings Equal

License

Apache License

Declaration

public static boolean areStringsEqual(String s1, String s2, boolean caseInsensitive) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static boolean areStringsEqual(String s1, String s2) {
        return areStringsEqual(s1, s2, false);
    }/*w w w .j  a  v a  2  s  .  com*/

    public static boolean areStringsEqual(String s1, String s2, boolean caseInsensitive) {
        if (s1 == null)
            return s2 == null;
        if (caseInsensitive)
            return s1.equalsIgnoreCase(s2);
        else
            return s1.equals(s2);
    }

    public static boolean areStringsEqual(String s1, String s2, boolean caseInsensitive,
            boolean dontDistinctNullAndEmpty) {
        if (dontDistinctNullAndEmpty && (s1 == null || s1.length() == 0))
            return s2 == null || s2.length() == 0;
        return areStringsEqual(s1, s2, caseInsensitive);
    }
}

Related

  1. areEqualsIgnoreCaseAndTrim(final String s1, final String s2)
  2. areEqualXMLValues(String s1, String s2)
  3. areStringEquals(String s1, String s2)
  4. areStringEquals(String string1, String string2)
  5. areStringsEqual(String one, String two)
  6. areStringsEqual(String s1, String s2, boolean caseInsensitive, boolean dontDistinctNullAndEmpty)
  7. areStringsEqual(String str1, String str2)
  8. collapseQualifier(String qualifier, boolean includeDots)
  9. equalsCaseless(String sA_, String sB_)