Here you can find the source of convertToString(String[] values, String separator)
Parameter | Description |
---|---|
values | the values |
separator | the separator |
public static String convertToString(String[] values, String separator)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { /**//from ww w . j ava2 s . co m * Convert to string. * * @param values the values * @param separator the separator * @return the string */ public static String convertToString(String[] values, String separator) { StringBuilder converted = new StringBuilder(); if (values != null) { for (String value : values) { if (converted.length() > 0) { converted.append(separator); } converted.append(value); } } return converted.toString(); } /** * Convert to string. * * @param values the values * @param separator the separator * @return the string */ public static String convertToString(List<String> values, String separator) { StringBuilder converted = new StringBuilder(); if (values != null) { for (String value : values) { if (converted.length() > 0) { converted.append(separator); } converted.append(value); } } return converted.toString(); } }