How to escape Comma from the String

1
Hi , I m creating an String with few names and converting the string to file. Using Comma as the delimiter i trying to form an CSV file using the above string. Since few names also have Comma in them , the system is considering the name as two components and is showing the names in different cell. I want to escape the comma char while writing the data to the file .The name with comma should b treated as one value and should be shown in single cell. Thanks, Swathi
asked
3 answers
1

Hi Swathi,

You can use the replaceAll function for this.

answered
0

I m sorry.................. may b i have asked wrong question..I want to escape the comma char while writing the data to the file –

answered
0

The csv file format has an RFC where you can find how to escape a comma. See this loacation: http://tools.ietf.org/html/rfc4180 You need to use double quotes to escape line breaks, double quotes and comma's.

Regards,

Ronald

answered