1 | |
|
2 | |
|
3 | |
|
4 | |
package net.sf.statcvs.util; |
5 | |
|
6 | |
import java.util.ArrayList; |
7 | |
import java.util.Collections; |
8 | |
import java.util.List; |
9 | |
import java.util.StringTokenizer; |
10 | |
|
11 | 0 | |
12 | 0 | |
13 | |
|
14 | |
|
15 | |
public final class StringUtils { |
16 | 0 | private StringUtils() { |
17 | 0 | } |
18 | 300 | |
19 | |
|
20 | |
|
21 | |
|
22 | |
public static boolean isNotEmpty(final String txt) { |
23 | 0 | return txt != null && txt.trim().length() > 0; |
24 | |
} |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
public static List listify(final String str, final String delimiter) { |
36 | 0 | if (str == null) { |
37 | 0 | return Collections.EMPTY_LIST; |
38 | |
} |
39 | |
|
40 | 0 | final StringTokenizer tok = new StringTokenizer(str, delimiter); |
41 | 0 | final List list = new ArrayList(); |
42 | |
|
43 | 0 | while (tok.hasMoreElements()) { |
44 | 0 | list.add(StringUtils.trim(tok.nextToken())); |
45 | |
} |
46 | |
|
47 | 0 | return list; |
48 | |
} |
49 | |
|
50 | |
public static String trim(String tok) { |
51 | 0 | return tok != null ? tok.trim() : null; |
52 | |
} |
53 | |
|
54 | |
} |