Last change
on this file since 1575 was 1575, checked in by stoecker, 15 years ago |
close #2443 - patch by Henrik Niehaus - History for commit dialog
|
File size:
911 bytes
|
Line | |
---|
1 | package org.openstreetmap.josm.gui.historycombobox;
|
---|
2 |
|
---|
3 | import java.util.ArrayList;
|
---|
4 | import java.util.Iterator;
|
---|
5 | import java.util.List;
|
---|
6 |
|
---|
7 | public class StringUtils {
|
---|
8 | public static List<String> stringToList(String string, String delim) {
|
---|
9 | List<String> list = new ArrayList<String>();
|
---|
10 | if(string != null && delim != null) {
|
---|
11 | String[] s = string.split(delim);
|
---|
12 | for (String str : s) {
|
---|
13 | list.add(str);
|
---|
14 | }
|
---|
15 | }
|
---|
16 | return list;
|
---|
17 | }
|
---|
18 |
|
---|
19 | public static String listToString(List<String> list, String delim) {
|
---|
20 | if(list != null && list.size() > 0) {
|
---|
21 | Iterator<String> iter = list.iterator();
|
---|
22 | StringBuilder sb = new StringBuilder(iter.next());
|
---|
23 | while(iter.hasNext()) {
|
---|
24 | sb.append(delim).append(iter.next());
|
---|
25 | }
|
---|
26 | return sb.toString();
|
---|
27 | }
|
---|
28 | return "";
|
---|
29 | }
|
---|
30 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.