Java CSV String Create toCsv(Object[] arr, String format)

Here you can find the source of toCsv(Object[] arr, String format)

Description

to Csv

License

Open Source License

Declaration

public static String toCsv(Object[] arr, String format) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String toCsv(Object[] arr, String format) {
        String ans = "";

        if (arr.length > 0) {
            ans += String.format(format, arr[0]);
        }/*from  w w  w. j  a  va 2s  . c  o m*/

        String format2 = "," + format;
        for (int i = 1; i < arr.length; i++) {
            ans += String.format(format2, arr[i]);
        }
        ans += "\n";

        return ans;
    }
}

Related

  1. getCSV(Collection coll)
  2. getCSV(Collection values)
  3. getCsv(Collection collection)
  4. getCSVPhrase(Collection objects)
  5. toCSV(int[] a)
  6. toCsv(String value)
  7. toCSV3_2(double[][][] array, int index1, int index3)
  8. toCSVBuffer(byte barr[])
  9. toCsvLine(final String[] parts)