Here you can find the source of arrayToString(String[] strs)
Parameter | Description |
---|---|
strs | Array of strings |
public static String arrayToString(String[] strs)
//package com.java2s; public class Main { /**//from w ww . j av a 2 s. co m * Given an array of strings, return a comma-separated list of its elements. * @param strs Array of strings * @return Empty string if strs.length is 0, comma separated list of strings * otherwise */ public static String arrayToString(String[] strs) { if (strs.length == 0) { return ""; } StringBuffer sbuf = new StringBuffer(); sbuf.append(strs[0]); for (int idx = 1; idx < strs.length; idx++) { sbuf.append(","); sbuf.append(strs[idx]); } return sbuf.toString(); } }