Java Array Split unsplit(String[] array, String seperator)

Here you can find the source of unsplit(String[] array, String seperator)

Description

unsplit

License

Open Source License

Declaration

public static String unsplit(String[] array, String seperator) 

Method Source Code

//package com.java2s;

import java.util.Iterator;

public class Main {
    public static String unsplit(String[] array, String seperator) {

        StringBuilder str = new StringBuilder();
        for (int i = 0; i < array.length; i++) {
            str.append(array[i]);//from w w  w. ja va 2  s.  c  o  m
            if (i < array.length - 1)
                str.append(seperator);
        }
        return str.toString();
    }

    public static String toString(Iterable<String> strs) {

        StringBuilder ret = new StringBuilder();
        for (Iterator<String> i = strs.iterator(); i.hasNext();) {
            ret.append(i.next());
            if (i.hasNext())
                ret.append(",");
        }
        return ret.toString();
    }
}

Related

  1. splitData(String[] sData, int numMaps)
  2. splitOrderByFirst(byte[] pattern, byte[] src, int offset)
  3. splitSentences(String[] sentence, int limitLength, String reg)
  4. splitStringOnFields(String in, int[] cuts)
  5. splitWordsL(String s, boolean splitOnWs, char[] delimiters)