1. equals()
Returns true if they are same and not null.
2. equalsIgnoreCase()
Returns true if they are same ignoring Case(Upper or Lower Case) and not null.
Returns true if they are same and not null.
2. equalsIgnoreCase()
Returns true if they are same ignoring Case(Upper or Lower Case) and not null.
Sample Code:
String str1 = 'abc';
String str2 = 'ABC';
system.debug( str1.equals( str2 ) );
system.debug( str1.equalsIgnoreCase( str2 ) );
String str2 = 'ABC';
system.debug( str1.equals( str2 ) );
system.debug( str1.equalsIgnoreCase( str2 ) );
Output:
No comments:
Post a Comment