Sample Code:
string conName = 'biswa'; string conNameLike = '%' + String.escapeSingleQuotes(conName.trim()) + '%'; String query = 'SELECT Id, FirstName, LastName From Contact Where Name LIKE :conNameLike'; List<Contact> conList = Database.query(query); System.debug('conList-' + conList);