function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MandadiMandadi 

How to check whether the string contains any quotation marks or not.

Hi All,

  I have List of String Values like [abc, “abcd” ,‘abcde’].
  Now i want to check all the string values and find which string contains single quotes(') and which one contains double quotes using apex.

Can any one help me how to solve this problem......


Thanks,
 Murali
  
Gupta.VishalGupta.Vishal
Use Escape character :  \'   to check like

String test='';

test.contains('\'');

Hope this helps !!
MandadiMandadi
Hi Vishal,

     If 

                 String test='\'abc\'';

     then only

                 test.contains('\'');       This statement will work..

But in my case the string is like 'abc'.

                 This time Contains method is not working.
Ramu_SFDCRamu_SFDC
JSENCODE might help. Review the below post & articles for more information on this

https://developer.salesforce.com/forums/ForumsMain?id=906F00000008oE7IAI

http://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_functions.htm