I have searched the internet about the comma issues about csv document.But my trouble is about dealing with the value containing not only comma but also quote.
like String value = "FName,\"FName2,FName3";
I want to display the string FName,”FName2,FName3 in the csv document.Though i tried a couple of approaches,but failed.
When the string contains comma,I can use double quote to surround it like code below.
outBuff.append("\\").append(cellData).append("\\").append(",");
But when the string contains “” and ,
How can i deal with this issue?
I can only use the pulest java,and can not use the third part library.
Thanks.
Consider using os specialized CSV parser, like one from Apache Commons
It will handle most of corner cases for you