Here you can find the source of convertStringToVector(String source, String separator)
Parameter | Description |
---|---|
source | The string to convert |
separator | The seprator used by the source |
public static Vector convertStringToVector(String source, String separator)
//package com.java2s; /* IBS Copyright/Security Notice *************************************** * * BAP Property of IBS AB/*w w w. ja va2 s .com*/ * (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 String into a vector * * @param source The string to convert * @param separator The seprator used by the source * @return Vector with strings or null if source or separator not specified */ public static Vector convertStringToVector(String source, String separator) { if (source == null || separator == null) { return null; } Vector v = new Vector(); StringTokenizer st = new StringTokenizer(source, separator); while (st.hasMoreTokens()) { v.addElement(st.nextToken().trim()); } return v; } }