Check Field data before exporting to CSV format
This function takes a string, and checks to see if it needs to be wrapped in double quotes. This is important for CSV files.
Each field is seperated by a comma, but if the data in that field contains a comma, it needs to be quoted. Also, because of those quotes, if the field data contains a quote it needs to be escaped (by adding another quote directly after it).
You would perform this function for every field in the row, not once for the entire row.
The Code Download
Added by JC on 14th January 2008
There are no comments about this snippet.
Post Comment Github Markdown Supported
You must be logged in to post a comment.
Login here to post a comment