Java Char Array to String charArrayToString(char[] ch, String separator)

Here you can find the source of charArrayToString(char[] ch, String separator)

Description

char Array To String

License

Apache License

Declaration

public static String charArrayToString(char[] ch, String separator) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static String charArrayToString(char[] ch, String separator) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < ch.length; i++) {
            sb.append(ch[i]);/*from ww w  .  jav a2 s .  co m*/
            if (ch.length != (i + 1)) {
                sb.append(separator);
            }
        }
        return sb.toString();
    }

    public static String charArrayToString(char[] ch) {
        return charArrayToString(ch, " ");
    }
}

Related

  1. charArrayToCharSequence( final char[] charArray)
  2. charArrayToString(char[] input, int offset, int length, int maxChars)
  3. charArrayToString(Character[] chars)
  4. charArrayToXml(char[] input, int offset, int length)
  5. charsToString(char[] chars)