Here you can find the source of join(String[] strArr)
Parameter | Description |
---|---|
strArr | a parameter |
public static String join(String[] strArr)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { /**//from w w w . ja v a2s. c o m * * @param strArr * @return */ public static String join(String[] strArr) { if (strArr == null) return null; StringBuilder ret = new StringBuilder(); for (int i = 0, len = strArr.length; i < len; i++) { ret.append(strArr[i]); if (i < len - 1) { ret.append(","); } } return ret.toString(); } /** * * @param strArr * @return */ public static String join(List<String> strArr) { if (strArr == null) return null; StringBuilder ret = new StringBuilder(); for (int i = 0, len = strArr.size(); i < len; i++) { ret.append(strArr.get(i)); if (i < len - 1) { ret.append(","); } } return ret.toString(); } }