Android String Array Join join(int[] arr, String delimiter)

Here you can find the source of join(int[] arr, String delimiter)

Description

join

Declaration

public static String join(int[] arr, String delimiter) 

Method Source Code

//package com.java2s;

public class Main {
    public static String join(String delimiter, String[] strings) {

        if (strings.length == 0) {
            return "";
        }/*w  w  w .j  a v  a2  s .  c  om*/

        StringBuilder stringBuilder = new StringBuilder();
        for (String str : strings) {
            stringBuilder.append(" ").append(str);
        }

        return stringBuilder.substring(1);
    }

    public static String join(int[] arr, String delimiter) {

        if (arr.length == 0) {
            return "";
        }

        StringBuilder sb = new StringBuilder();

        for (int i : arr) {
            sb.append(delimiter).append(Integer.toString(i));
        }

        return sb.substring(delimiter.length());

    }
}

Related

  1. joinStrings(String joiner, Iterable parts)
  2. join(String spliter, Object[] arr)
  3. join(String[] strings, String separator)
  4. join(String[] s, String glue)
  5. join(String delimiter, String[] strings)
  6. join(String[] parts, String delimiter)
  7. join(String delimiter, Object... chunks)
  8. join(String separator, Object... texts)
  9. join(String[] track)