Java Vector from String implode(Vector handler, String separator)

Here you can find the source of implode(Vector handler, String separator)

Description

implode, link a vector into a string with a separate string

License

Apache License

Parameter

Parameter Description
handler a parameter
separator a parameter

Return

String, linked string

Declaration

public static String implode(Vector handler, String separator) 

Method Source Code


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

import java.util.*;

public class Main {
    /**// w w w .ja v  a2s . c  o m
     * implode, link a vector into a string with a separate string
     *
     * @param handler
     * @param separator
     * @return String, linked string
     */
    public static String implode(Vector handler, String separator) {
        StringBuffer strbuf = new StringBuffer();
        try {
            if (!handler.isEmpty()) {
                int len = handler.size();
                for (int loopi = 0; loopi < len; loopi++) {
                    strbuf.append((String) handler.get(loopi));
                    if (loopi != len - 1)
                        strbuf.append(separator);
                }
            }
        } catch (Exception error) {
            error.printStackTrace();
        }
        return strbuf.toString();
    }
}

Related

  1. convertStringToVector(String source, String separator)
  2. createNodeValueVector(final String val)
  3. getKeyStringAsVector(String keyString, String separator)
  4. getposString(Vector vect_valores, String valor)
  5. getStringFromTokens(Vector vector, String delimiter)
  6. implode(Vector strings, char delim)
  7. orderedStringInsert(String key, Vector into)
  8. parseArgumentVector(String argStr)
  9. reverseVector(final Vector src)