public static String formatCSV(Iterable<String> values){
  StrBuilder sb=new StrBuilder();
  for (  String value : values) {
    sb.appendSeparator(",");
    sb.append("\"");
    if (StringUtils.isNotEmpty(value)) {
      for (int i=0; i < value.length(); i++) {
        char ch=value.charAt(i);
        if (ch == '"') {
          sb.append('"');
        }
        sb.append(ch);
      }
    }
    sb.append("\"");
  }
  return sb.toString();
}

public static String formatCSV ( Iterable < String > values ) { StrBuilder sb = new StrBuilder ( ) ; for ( String value : values ) { sb . appendSeparator ( "," ) ; sb . append ( "\"" ) ; if ( StringUtils . isNotEmpty ( value ) ) { for ( int i = 0 ; i < value . length ( ) ; i ++ ) { char ch = value . charAt ( i ) ; if ( ch == '"' ) { sb . append ( '"' ) ; } sb . append ( ch ) ; } } sb . append ( "\"" ) ; } return sb . toString ( ) ; }
formats some values into comma - separated text .
