# HG changeset patch # User Sascha L. Teichmann # Date 1328783594 0 # Node ID 87c0393749f0f1e5f9152394d12fdc7b9f8dfec5 # Parent 33176e6e3c37548ce0fc6a1056750e72e73c3b6b StringUtils: Added static method to join strings with a separator. artifacts/trunk@3989 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 33176e6e3c37 -r 87c0393749f0 ChangeLog --- 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 +012-02-09 Sascha L. Teichmann + + * 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 * artifact-database/src/main/java/de/intevation/artifactdatabase/state/ArtifactAndFacet.java: Added Override annotations. diff -r 33176e6e3c37 -r 87c0393749f0 artifacts-common/src/main/java/de/intevation/artifacts/common/utils/StringUtils.java --- 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 :