Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 266
  • Last Modified:

Surround each value in CSV string by single quotes

I need to take a string = 1234,56789
And I need to add single quotes around each one of the values seperated by the comma - so, e.g.  1234,56789 becomes '1234','56789'

Not sure if I need to split them and then join them back up, etc.?
0
tbaseflug
Asked:
tbaseflug
2 Solutions
 
strickddCommented:
string myCSV = "1234,56789"

myCSV = "'" + myCSV.Replace(",", "','") + "'"
0
 
Ramkisan JagtapLead DeveloperCommented:
mycsv=mycsv.replace(",","\",\"");
0
 
tbaseflugAuthor Commented:
perfect - needed it in JS - so this works
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now