I have a string in the following format :
One,Two,Three,Four and I want to change its format to "One","Two","Three","Four"
I tried the following :
var items = ['One,Two,Three,Four']; var quotedAndCommaSeparated = '"' + items + '"'; document.write(quotedAndCommaSeparated); which adds the double quotes at the beginning and at the end of the string. I don't want to use replace because there might be values that have a comma.
Is there a way to split the initial string and return the wanted one?
there might be values that have a commahow do you determine wether a comma seperates two values or is part of one of them?