Here you can find the source of arrayToString(String[] array, String separator)
Parameter | Description |
---|---|
array | a parameter |
separator | a parameter |
public static String arrayToString(String[] array, String separator)
//package com.java2s; public class Main { /**//from w ww . j a v a 2s . c o m * Converts string array to single string separating fields with specified * separator. * * @param array * @param separator * @return */ public static String arrayToString(String[] array, String separator) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < array.length; i++) { if (i != 0) { builder.append(separator); } builder.append(array[i]); } return builder.toString(); } }