Here you can find the source of joinStrings(List
Parameter | Description |
---|---|
strings | a parameter |
separator | a parameter |
public static String joinStrings(List<String> strings, String separator)
//package com.java2s; /*//w w w. j a v a2 s . c o m * Copyright (C) 2006-2016 Talend Inc. - www.talend.com * * This source code is available under agreement available at * %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt * * You should have received a copy of the agreement along with this program; if not, write to Talend SA 9 rue Pages * 92150 Suresnes, France */ import java.util.List; public class Main { /** * Join an arraylist of strings into a single string using a separator * * @param strings * @param separator * @return a single string or null */ public static String joinStrings(List<String> strings, String separator) { if (strings == null) { return null; } String res = ""; //$NON-NLS-1$ for (int i = 0; i < strings.size(); i++) { res += (i > 0) ? separator : ""; //$NON-NLS-1$ res += strings.get(i); } return res; } }