+ Start a Discussion
SandrineSandrine 

replace semicolon with double quote and comma

Hello,

I am trying to replace  ; with ", "

I wrote below code ,jsonBody = jsonBody.replace(';','", "');

But in the string it alwyas appears the same

What can be the reason for the problem
Best Answer chosen by Sandrine
AbhishekAbhishek (Salesforce Developers) 
Sandrine you also try this,

Example:-

Use single quotes to encase the double quote!
SUBSTITUTE(Name,'"', '')

Just as you use double quotes to encase a single quote
SUBSTITUTE(Name,"'", "")

I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.

Thanks.

All Answers

David Zhu 🔥David Zhu 🔥
I would use:
jsonBody = jsonBody.replace(';',',');
RSuzukiRSuzuki
Try 
jsonString = jsonString.replaceAll(';','","');

 
AbhishekAbhishek (Salesforce Developers) 
Sandrine you also try this,

Example:-

Use single quotes to encase the double quote!
SUBSTITUTE(Name,'"', '')

Just as you use double quotes to encase a single quote
SUBSTITUTE(Name,"'", "")

I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.

Thanks.
This was selected as the best answer