How To Write A Value That Contains A Comma To A Csv File?
I have a javascript program to write values to a csv file. I have a value that includes comma within. How to do this? I am newbie to javascript. can you please help me? I tried dou
Solution 1:
Close them in quotes and escape double quotes?
http://en.wikipedia.org/wiki/Comma-separated_values
1999,Chevy,"Venture ""Extended Edition""",4900.00
in your case:
"," + "record.assets" + ","
should be
"," + '"' + record.assets.replace(/"/g,'""') + '"' + ","
Solution 2:
You can put your text between quotes. You are not obliged to use a comma , you can use a ";" too (dutch/german format but works well) --> http://en.wikipedia.org/wiki/Comma-separated_values 1997;Ford;E350;2,34
Post a Comment for "How To Write A Value That Contains A Comma To A Csv File?"