static String checkSurroundByQuotes ( String delimiter , String trimmedText ) throws IOException { boolean containsDelimiter = stringContainsItemFromList ( trimmedText , delimiter , "\n" , "\t" , "\r" , "\"" ) ; String trimmedTextWithoutQuotesDuplicates = trimmedText . replace ( "\"" , "\"\"" ) ; if ( containsDelimiter && trimmedTextWithoutQuotesDuplicates . length ( ) != 0 ) { return "\"" + trimmedTextWithoutQuotesDuplicates + "\"" ; } return trimmedTextWithoutQuotesDuplicates ; }
The method to output a text represented by an array of bytes . If the text contains the delimiter line breaks tabulation characters and double quotes the text is stropped .