Like operator in Salesforce

Example:

String sql = 'Select Name From Account WHERE Name LIKE \'%' + searchKeyword + '%\'';

where searchKeyword is an Apex variable.

or

List<Contact> listCon = [SELECT Id, FirstName FROM Contact WHERE FirstName LIKE '%test%'];

system.debug('List contacts are ' + listCon);


Cheers!!!

1 comment: