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
Mani PenumarthiMani Penumarthi 

How to convert the special charaters while working with SOAP services

Here is the example how I was getting a data from webservices with special character ( ' ) in string

String text = 'dlafdhfasdfsd ' dsdfsdfdsfsd' ;

How could I dynamically convert such special characters.

pconpcon
You could use the escapeSingleQuotes method

String escapedText = String.escapeSingleQuotes(text);
Mani PenumarthiMani Penumarthi
Thanks pcon. It worked fine for this senario. Is there any other way to skip special charaters such "&,$,etc..," as I need to pass this values in the URL.
pconpcon
Then you'll want to use EncodingUtils

String escapedText = EncodingUtil.urlEncode(text, 'UTF-8');