01: // Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
02: // Released under the terms of the GNU General Public License version 2 or later.
03: package fitnesse.util;
04:
05: import java.util.*;
06:
07: public class StringUtil {
08: public static String join(List strings, String delimiter) {
09: if (strings.isEmpty())
10: return "";
11:
12: Iterator i = strings.iterator();
13: StringBuffer joined = new StringBuffer((String) i.next());
14:
15: for (/* declared above */; i.hasNext();) {
16: String eachLine = (String) i.next();
17: joined.append(delimiter);
18: joined.append(eachLine);
19: }
20:
21: return joined.toString();
22: }
23:
24: public static String[] combineArrays(String[] first, String[] second) {
25: List combinedList = new LinkedList();
26: combinedList.addAll(Arrays.asList(first));
27: combinedList.addAll(Arrays.asList(second));
28: return (String[]) combinedList.toArray(new String[combinedList
29: .size()]);
30: }
31: }
|