Activity Forums Salesforce® Discussions How to compare two strings in Apex in Salesforce?

  • MOHIT

    Member
    August 5, 2020 at 10:54 am

    String comparisonequals() method should be used for content comparison instead. Unlike Java, the == operator in Apex compares object value equality and not reference equality. The exception is user-defined types. Thus, for sObjects and sObjects arrays comparison the == operator should be used.

  • Ayush

    Member
    August 5, 2020 at 11:27 am

    the comparison of Strings using the == operator and using the Object.equals() method.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos