question: private static String csvFormat ( String s ) { if ( s . contains ( "\"" ) || s . contains ( "\n" ) || s . contains ( "," ) ) { return "\"" + s . replace ( "\"" , "\"\"" ) + "\"" ; } return s ; }
target:  Formats a string and returns it so that it can be inserted into a CSV file without disrupting the formatting of the file and the string. Specifically, quotation marks are added around the string if it contains new-line characters, commas, or quotation marks. Each quotation mark inside the string is also replaced with two quotation marks.