Here you can find the source of implode(String... strings)
Parameter | Description |
---|---|
strings | The string to format. |
public static String implode(String... strings)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w . j av a 2 s. c om*/ * "Implodes" an array of strings into one string. Equivilant to java's join() method. * @param strings The string to format. * @return The imploded string. */ public static String implode(String... strings) { return implode(strings, ""); } /** * "Implodes" an array of strings into one string. Equivilant to java's join() method. * @param strings The string to format. * @param glue The string to insert between each index of the array. * @return The imploded string. */ public static String implode(String[] strings, String glue) { String output = ""; if (strings.length > 0) { StringBuilder sb = new StringBuilder(); sb.append(strings[0]); for (int i = 1; i < strings.length; i++) { sb.append(glue); sb.append(strings); } output = sb.toString(); } return output; } }