Like Operator usage in Apex

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!!!

No comments:

Post a Comment