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

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

Use Escape character :  \'   to check like

String test='';


Hope this helps !!
Hi Vishal,


                 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.
JSENCODE might help. Review the below post & articles for more information on this