The abbreviation CSV means "Comma Separated Values", but in practice, this abbreviation is used for all files containing values that are separated by some separator-character. That's why spreadsheet applications like Open Office Calc or Microsoft Excel open up a dialog window letting you configure the separator and quoting character when you attempt to open a file with the file-extension .csv
.
If your question is how the separator-character can be part of a value of a CSV file, the most common way is quoting the values. Here is in example of the quoting being done with the values
a,b
c"d
e
with ,
as the separator character and "
as the quoting character
"a,b","c""d", e
The second way of quoting is the way Excel does it, you can also see variants where the quoting is done in the same way as the first example.
There are libraries out there that do the parsing and creation of CSV files for you. We "here" use the Ostermiller CSV library (there might be better ones nowerday but it does its job so there was no need to change the library after we introduced it "here" 10 years ago.