Here you can find the source of convertVectorToString(Vector source, String separator)
Parameter | Description |
---|---|
source | The Vector to convert |
separator | The separator to used |
public static String convertVectorToString(Vector source, String separator)
//package com.java2s; /* IBS Copyright/Security Notice *************************************** * * BAP Property of IBS AB//from w w w . ja v a 2 s . c o m * (C) Copyright IBS AB 2001-2003 * All rights reserved. * Use, duplication, or disclosure restricted * by license agreement with IBS AB. * * Licensed Materials - Property of IBS AB * * End IBS Copyright/Security Notice ********************************** * * * User Date Comment * --------------------------------------------------------------------- * DMA 01/01/2000 Class created * ***********************************************************************/ import java.util.*; public class Main { /** * Convert the passed vector into a string with separators * * @param source The Vector to convert * @param separator The separator to used * @return String or null if source or separator not specified */ public static String convertVectorToString(Vector source, String separator) { if (source == null || separator == null) { return null; } StringBuffer sb = new StringBuffer(""); int si = source.size(); for (int i = 0; i < si; i++) { sb.append(source.elementAt(i).toString()); if ((i + 1) < si) { sb.append(separator); } } return sb.toString(); } }