Android Utililty Methods String Array Join

List of utility methods to do String Array Join

Description

The list of methods to do String Array Join are organized into topic(s).

Method

Stringimplode(String[] strings, String glue)
implode
StringBuilder stringBuilder = new StringBuilder();
if (strings == null)
    return "";
for (int i = 0; i < strings.length; i++) {
    stringBuilder.append(strings[i]);
    if (i != strings.length - 1) {
        stringBuilder.append(glue);
return stringBuilder.toString();
Stringconcatenate(String[] elements, String delimiter)
concatenate
StringBuilder out = new StringBuilder();
for (int i = 0; i < elements.length; i++) {
    String element = elements[i];
    if (i > 0) {
        out.append(delimiter);
    out.append(element);
return out.toString();
StringmakeDivideString(String[] arr_str, String divide_str)
make Divide String
if (arr_str == null)
    return null;
if (arr_str.length == 0)
    return "";
StringBuilder sb = new StringBuilder();
for (String e : arr_str) {
    sb.append(e);
    sb.append(divide_str);
...
Stringjoin(String spliter, Object[] arr)
join
if (arr == null || arr.length == 0) {
    return "";
if (spliter == null) {
    spliter = "";
StringBuilder builder = new StringBuilder();
for (int i = 0; i < arr.length; i++) {
...
StringjoinStrings(String joiner, Iterable parts)
join Strings
StringBuilder builder = new StringBuilder();
boolean first = true;
for (String part : parts) {
    if (!first) {
        builder.append(joiner);
    builder.append(part);
    first = false;
...
Stringjoin(String spliter, Object[] arr)
join
if (arr == null || arr.length == 0) {
    return "";
if (spliter == null) {
    spliter = "";
StringBuilder builder = new StringBuilder();
for (int i = 0; i < arr.length; i++) {
...
Stringjoin(String[] strings, String separator)
join
StringBuffer sb = new StringBuffer();
for (int i = 0; i < strings.length; i++) {
    if (i != 0)
        sb.append(separator);
    sb.append(strings[i]);
return sb.toString();
Stringjoin(String[] s, String glue)
join
int k = s.length;
if (k == 0)
    return null;
StringBuilder out = new StringBuilder();
out.append(s[0]);
for (int x = 1; x < k; ++x)
    out.append(glue).append(s[x]);
return out.toString();
...
Stringjoin(String delimiter, String[] strings)
join
if (strings.length == 0) {
    return "";
StringBuilder stringBuilder = new StringBuilder();
for (String str : strings) {
    stringBuilder.append(" ").append(str);
return stringBuilder.substring(1);
...
Stringjoin(int[] arr, String delimiter)
join
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());
...