Here you can find the source of implode(String[] data, String delimiter)
Parameter | Description |
---|---|
data | the strings that should be concatinated |
delimiter | the delimiter |
public static String implode(String[] data, String delimiter)
//package com.java2s; //License from project: Open Source License public class Main { /**// w ww . java2 s . c o m * Concats the String[] array data to a single String, using the specified delimiter as the * glue. <code>implode({"A", "B", "C"}, ";")</code> would result in A;B;C * * @param data the strings that should be concatinated * @param delimiter the delimiter * @return the concatinated string */ public static String implode(String[] data, String delimiter) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < data.length; i++) { if (i != 0) { sb.append(delimiter); } sb.append(data[i]); } return sb.toString(); } }