How to write strings with double quotes in csv files?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nesha
    New Member
    • Sep 2010
    • 9

    #1

    How to write strings with double quotes in csv files?

    Hi,
    I want to write some data in csv file. Im using CSVPrinter() for this.However i got the output as
    Code:
    name, place
    But i want this is to be like
    Code:
    "name","place"
    How to get this type of output. Can anyone please help me?
  • Will Huang

    #2
    To print quotes you would use this escape character : \"

    So for example:
    Code:
    System.out.println("\"Hello\"");

    Comment

    Working...