集册 Java实例教程 到Csv记录

到Csv记录

欢马劈雪     最近更新时间:2020-01-02 10:19:05

562
到Csv记录


//package com.nowjava;

/*
时 代 J     a    v  a - nowjava.com
*/

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 n o w j a v a . c o m

                }

                buf.append(enclose(fields[i]));

            }

        }

        return buf.toString();

    }


    public 
展开阅读全文