Java Array to CSV ArrayToCSV(String[] array)

Here you can find the source of ArrayToCSV(String[] array)

Description

Array To CSV

License

Open Source License

Declaration

public static String ArrayToCSV(String[] array) 

Method Source Code

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

public class Main {
    public static String ArrayToCSV(String[] array) {
        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < array.length; i++) {
            String string = array[i];
            if (i == 0)
                sb.append(string);//from w w w  .  j av a2 s  .  c o m
            else
                sb.append("," + string);
        }
        return sb.toString();
    }
}

Related

  1. ArrayToCsv(Object[] line)
  2. arrayToCsvString(String[] array, char delimiter)
  3. toCSV(double[] as)
  4. toCSV(int[][] values)
  5. toCSV(Object[] objs)