Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static String ArrayToString(String[] values) { return ArrayToString(values, ','); } public static String ArrayToString(String[] values, char delimiter) { String result = ""; int offset = 0; for (String value : values) { if (value.indexOf(delimiter) >= 0) { result += "\"" + value + "\""; } else result += value; offset++; if (offset < values.length) { result += delimiter; } } return result; } }