KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > xdoclet > util > DocletUtil


1 /*
2  * Copyright (c) 2001, 2002 The XDoclet team
3  * All rights reserved.
4  */

5 package xdoclet.util;
6
7 import java.util.StringTokenizer JavaDoc;
8
9 /**
10  * @author Ara Abrahamian (ara_e@email.com)
11  * @author <a HREF="aslak.nospam@users.sf.net">Aslak Hellesøy</a>
12  * @created July 14, 2001
13  * @version $Revision: 1.19 $
14  */

15 public final class DocletUtil
16 {
17
18     /**
19      * Return an array of String from a String containing delimited values. For example "a,b,c" will return a String[3]
20      * {"a","b","c"}.
21      *
22      * @param delimited the String value to tokenize
23      * @param delimiter the delimiter ("," or ";" for example)
24      * @return an array of String delimited value
25      */

26     public static String JavaDoc[] tokenizeDelimitedToArray(String JavaDoc delimited, String JavaDoc delimiter)
27     {
28         StringTokenizer JavaDoc st = new StringTokenizer JavaDoc(delimited, delimiter);
29         String JavaDoc[] ret = new String JavaDoc[st.countTokens()];
30         int i = 0;
31
32         while (st.hasMoreTokens()) {
33             ret[i++] = st.nextToken();
34         }
35         return ret;
36     }
37 }
38
Popular Tags