changeset 376:87c0393749f0

StringUtils: Added static method to join strings with a separator. artifacts/trunk@3989 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 09 Feb 2012 10:33:14 +0000
parents 33176e6e3c37
children 1ffc09fec1c8
files ChangeLog artifacts-common/src/main/java/de/intevation/artifacts/common/utils/StringUtils.java
diffstat 2 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Feb 03 16:04:09 2012 +0000
+++ b/ChangeLog	Thu Feb 09 10:33:14 2012 +0000
@@ -1,4 +1,9 @@
-2012-01-30	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+012-02-09	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* artifacts-common/src/main/java/de/intevation/artifacts/common/utils/StringUtils.java(join):
+	  Added static method to join strings with a separator.
+
+012-01-30	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* artifact-database/src/main/java/de/intevation/artifactdatabase/state/ArtifactAndFacet.java:
 	  Added Override annotations.
--- a/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/StringUtils.java	Fri Feb 03 16:04:09 2012 +0000
+++ b/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/StringUtils.java	Thu Feb 09 10:33:14 2012 +0000
@@ -116,5 +116,14 @@
         }
         return d;
     }    
+
+    public static String join(String sep, String [] strings) {
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < strings.length; ++i) {
+            if (i > 0) sb.append(sep);
+            sb.append(strings[i]);
+        }
+        return sb.toString();
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org