This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to write comma in CSV file

 
Raza Mohd
Ranch Hand
Posts: 247
Java MyEclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i changed the constructor

 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll bet dollars to donuts that you still have no idea what in CSVWriter's terminology "escape characters" and "quote characters" are; otherwise you wouldn't be passing seemingly random values for those to the constructor.

Tell us this: why are you not using the constructor that takes nothing but the Writer as parameter? That's the one you should be using.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lester Burnham wrote:I give up.


It's worse than trying to give up smoking.
One more post can't do any harm. I'll stop again tomorrow. Honest.
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more post can't do any harm.

One likes to think so. It may even do some good, in due course. Hope springs eternal.
 
Raza Mohd
Ranch Hand
Posts: 247
Java MyEclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but i told you that it gives me Quotes when i open it in notepad if i use only writer as parameter

Thats the problem i have.

 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you did say that. And I replied "Of course there are quotes - that's how CSV works". If the individual cell entries contain commas, then those entries must be quoted. Why do you think that's a problem?

If you're still not sure how CSV works, I suggest to create an example file in Excel -having cells that contain both double quotes and commas- and to save that as a CSV. If you then open it in Notepad and study how the cell contents have (and have not) changed, you will get an understanding of CSV (which apparently so far you have not).
 
Raza Mohd
Ranch Hand
Posts: 247
Java MyEclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks dear..
actually in the need of fulfillment of client request .
I forgot it.

And also there is no tutorial about constructor.
I really did not understand how the NO_QUOTE_CHAR works.
can you tell me where can i find tutorials on that.

Thanks
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does that mean that the problem is now solved? Or are you saying that the client requires that there be no double quotes around entries, despite them containing commas? If the latter, then that's impossible, and you need to educate the client on how CSV works.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic