+ Start a Discussion
Debaranjan GhoshDebaranjan Ghosh 

Usage of equalgnorecase() with Contains() and isnull()

I am posting a code where I used Contains I would like to use equalgnorecase() along with that and also a null replace ment is done for which I would like to know the isnull() usgae 

System.debug(LoggingLevel.INFO, 'My Info Debug Message');
System.debug(LoggingLevel.FINE, 'My Fine Debug Message');
List<Account> accts = [SELECT Id, Name, parent.name FROM Account];
for(Account a : accts) {
    String Naa_Sup_Cvs_Omcare_Ac = a.name.toLowerCase();
    String Naa_Sup_Cvs_Omcare_Pr_Ac = a.parent.name == null ? '' :a.parent.name.toLowerCase();
    if(Naa_Sup_Cvs_Omcare_Ac.contains('ocare')||
       Naa_Sup_Cvs_Omcare_Ac.contains('pvs')||
       Naa_Sup_Cvs_Omcare_Pr_Ac.contains('ocare')||
       Naa_Sup_Cvs_Omcare_Pr_Ac.contains('pvs'))
    {System.debug('*****Non ocare/cvs Account Name: ' + a.name);
     System.debug('*****Non ocare/cvs Account  Parent Name: ' + a.parent.name);
    } 
}