Here you can find the source of arrayToStr(Object[] arr, char split)
Parameter | Description |
---|---|
split | a parameter |
public static String arrayToStr(Object[] arr, char split)
//package com.java2s; //License from project: Open Source License public class Main { /**//from ww w. j av a2 s . c om * e.g: String[] result={"TYHR0001","TYHR0002"}; split=","; return: * str="TYHR0001,TYHR0002"; * * @param Object[] * @param split * @return String */ public static String arrayToStr(Object[] arr, char split) { if (arr == null || arr.length == 0) { return null; } StringBuffer sb = new StringBuffer(); for (int i = 0; i < arr.length; i++) { if (i > 0) { sb.append(split); } sb.append(arr[i]); } return sb.toString(); } public static String arrayToStr(Object[] arr, String split) { if (arr == null || arr.length == 0) { return null; } StringBuffer sb = new StringBuffer(); for (int i = 0; i < arr.length; i++) { if (i > 0) { sb.append(split); } sb.append(arr[i]); } return sb.toString(); } }