Android Utililty Methods String Equal

List of utility methods to do String Equal

Description

The list of methods to do String Equal are organized into topic(s).

Method

booleanequals(String str1, String str2)
equals
return str1 == str2 || str1 != null && str1.equals(str2);
booleanequalsIgnoreCase(String str1, String str2)
equals Ignore Case
return str1 != null && str1.equalsIgnoreCase(str2);
booleanisEquals(String a, String b)
is Equals
return a.compareTo(b) == 0;
booleanequals(final CharSequence cs1, final CharSequence cs2)
equals
if (cs1 == cs2) {
    return true;
if (cs1 == null || cs2 == null) {
    return false;
return cs1.toString().equals(cs2.toString());
booleanequals(String str1, String str2)
Comparing two strings, returns true if they are equal, if both are null -> result == true
if (str1 == null) {
    return str2 == null;
return str1.equals(str2);
booleanequal(String s1, String s2)
equal
if (s1 == s2) {
    return true;
if (s1 == null) {
    return false;
return s1.equals(s2);
booleanisEquals(String str1, String str2)
is Equals
if (str1 == str2) {
    return true;
if (str1 != null) {
    return str1.equals(str2);
} else {
    return false;
booleanequals(String str1, String str2)
equals
return str1 == null ? str2 == null : str1.equals(str2);
booleanequalsIgnoreCase(String str1, String str2)
equals Ignore Case
return str1 == null ? str2 == null : str1.equalsIgnoreCase(str2);
booleanequalsIgnoreCase(String string1, String string2)
This method is missing in CLDC 1.0 String implementation
if (string1 == null && string2 == null) {
    return true;
if (string1 == null || string2 == null) {
    return false;
if ((string1.toLowerCase()).equals(string2.toLowerCase())) {
    return true;
...