Java examples for File Path IO:CSV File
to Csv Record
//package com.java2s; public class Main { public static final String CSV_SEP = ","; public static String toCsvRecord(String... fields) { StringBuilder buf = new StringBuilder(); if (fields != null) { for (int i = 0; i < fields.length; i++) { if (i != 0) { buf.append(CSV_SEP); }/*from ww w . ja v a 2 s .c om*/ buf.append(enclose(fields[i])); } } return buf.toString(); } public static String enclose(String field) { return "\"" + field + "\""; } }