Java Array to Delimited String arrayToTabSeparatedString( final String[] values)

Here you can find the source of arrayToTabSeparatedString( final String[] values)

Description

array To Tab Separated String

License

Open Source License

Declaration

public static final String arrayToTabSeparatedString(
            final String[] values) 

Method Source Code

//package com.java2s;
/* *********************************************************************** *
 * project: org.matsim.*//ww  w. ja va2 s  .c  om
 *                                                                         *
 * *********************************************************************** *
 *                                                                         *
 * copyright       : (C) 2010 by the members listed in the COPYING,        *
 *                   LICENSE and WARRANTY file.                            *
 * email           : info at matsim dot org                                *
 *                                                                         *
 * *********************************************************************** *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *   See also COPYING, LICENSE and WARRANTY file                           *
 *                                                                         *
 * *********************************************************************** */

public class Main {
    public static final String arrayToTabSeparatedString(
            final String[] values) {
        boolean isFirst = true;
        StringBuilder str = new StringBuilder();
        for (String mode : values) {
            if (!isFirst) {
                str.append("\t");
            }
            str.append(mode);
            isFirst = false;
        }
        return str.toString();
    }
}

Related

  1. arrayToDelimitedString(Object[] arr, String delim)
  2. arrayToDelimitedString(Object[] arr, String delim)
  3. arrayToDelimitedString(String[] values, String delimiter)
  4. arrayToDelimitedString(T[] array, String left, String delimiter, String right)
  5. arrayToReadableString(String[] array)
  6. arrayToText(String[] values, String delimiter)