java - Insert two double quote after encountering a specific sequence of character -


i have been search net suitable code requirement, not getting any.

i have csv file (values not exact, 1 of field of actual csv contains bmp image code)

"name","rolenumber","section","seat","comment" "abhik","45","avc","a112004ddg","hello3434?" "bob",,"avc","fdfdf1212","in field user can mistakenly add 2 commas ,, or ,,," "john",,,"dfdfedd22e","hel;o again"

the requirement somehow insert "" between every 2 or more ,(commas) (,, or more commas tell me field value blank except comment field user can enter mistake shown in example) program can understand blank values (it existing logic dont want change if ican it)

so after parsing csv rows should "name","rolenumber","section","seat","comment" "abhik","45","avc","a112004ddg","hello3434?" "bob","","avc","fdfdf1212","in field user can mistakenly add 2 commas ,, or ,,," "john","","","dfdfedd22e","hel;o again"

please help! in advance!

if playing csv files, use apache csv libraries... rid of quotes , empty values between 2 commas.

the problem here is, can not use string's replace or replaceall because these commas can part of value inside quotes too...


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -