Java Utililty Methods String Array to String

List of utility methods to do String Array to String

Description

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

Method

StringargsToString(String args[], int minindex, int maxindex)
args To String
StringBuilder sb = new StringBuilder();
for (int i = minindex; i < maxindex; i++) {
    sb.append(args[i]);
    sb.append(" ");
return sb.toString();
StringargsToString(String separator, T... args)
Converts varargs of objects to a string.
StringBuilder sb = new StringBuilder();
for (T s : args) {
    if (sb.length() != 0) {
        sb.append(separator);
    sb.append(s);
return sb.toString();
...
StringargsToString(String[] args)
args To String
if (args == null || args.length == 0) {
    return "";
boolean firstTime = true;
StringBuilder sb = new StringBuilder();
for (String s : args) {
    if (!firstTime) {
        sb.append(":");
...
StringargsToString(String[] args, int start)
args To String
StringBuilder builder = new StringBuilder();
for (int i = start; i < args.length;) {
    builder.append(args[i++]);
    if (i < args.length) {
        builder.append(' ');
    } else {
        break;
return builder.toString();
StringargsToString(String[] args, int startFrom)
args To String
if (args.length == 0) {
    return "";
String ret = "";
for (int i = startFrom; i < args.length; i++) {
    ret += args[i] + " ";
return ret.substring(0, ret.length() - 1);
...
Stringarr2str(String[] arr)
arrstr
if (arr == null) {
    return "";
StringBuffer sb = new StringBuffer();
for (int i = 0; i < arr.length; i++) {
    if (i > 0)
        sb.append("|");
    sb.append(arr[i]);
...
Stringarr2str(String[] arr, String sep)
arrstr
if (arr.length > 0) {
    StringBuffer sb = new StringBuffer();
    for (String s : arr) {
        sb.append(s).append(sep);
    return sb.toString().substring(0, sb.toString().lastIndexOf(sep));
} else {
    return null;
...
Stringarray2str(String[] array, String delim)
arraystr
StringBuffer s = new StringBuffer();
for (int i = 0; i < array.length; i++) {
    if (i != 0) {
        s.append(delim);
    s.append(array[i]);
return s.toString();
...
Stringarray2str(String[] arrayname, int length)
arraystr
StringBuffer strbuf = new StringBuffer();
for (int i = 0; i < length; i++) {
    strbuf.append("0");
for (int i = 0; i < arrayname.length; i++) {
    strbuf.replace(Integer.parseInt(arrayname[i]) - 1, Integer.parseInt(arrayname[i]), "1");
return strbuf.toString();
...
Stringarray2string(String array[])
arraystring
if (array == null) {
    return "";
String str = "";
for (int i = 0; i < array.length; i++) {
    str += array[i] + ",";
return str.substring(0, str.length() - 1);
...