Here you can find the source of convertArrayToString(String[] array, String separator)
Parameter | Description |
---|---|
array | array which is to be converted into string |
separator | separator between two element of array. |
public static String convertArrayToString(String[] array, String separator)
//package com.java2s; //License from project: LGPL public class Main { /**//from www. java2 s. com * * * This method convert array to a string which is seperated by a seprator passed in argument. * * @param array array which is to be converted into string * @param separator separator between two element of array. * @return String string data */ public static String convertArrayToString(String[] array, String separator) { StringBuilder builder = new StringBuilder(); for (String string : array) { if (string != null) { builder.append(separator).append(string); } } return builder.substring(separator.length()); } }