Added a concatenate method. While this is just a join with a "" delimiter,
the Avalon StringUtil shows that this is a valid way of looking at the
functionality.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@136939 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/java/org/apache/commons/lang/StringUtils.java b/src/java/org/apache/commons/lang/StringUtils.java
index 2034bcf..100b528 100644
--- a/src/java/org/apache/commons/lang/StringUtils.java
+++ b/src/java/org/apache/commons/lang/StringUtils.java
@@ -80,7 +80,7 @@
* @author <a href="mailto:ed@apache.org">Ed Korthof</a>
* @author <a href="mailto:rand_mcneely@yahoo.com>Rand McNeely</a>
* @author <a href="mailto:scolebourne@joda.org>Stephen Colebourne</a>
- * @version $Id: StringUtils.java,v 1.3 2002/07/21 20:19:50 bayard Exp $
+ * @version $Id: StringUtils.java,v 1.4 2002/07/23 05:21:28 bayard Exp $
*/
public class StringUtils {
@@ -469,6 +469,16 @@
// Joining
//--------------------------------------------------------------------------
+ /**
+ * Concatenates elements of an array into a single string.
+ * The difference from join is that concatenate has no delimiter.
+ *
+ * @param array the array of values to concatenate.
+ * @return the concatenated string.
+ */
+ public static String concatenate(Object[] array) {
+ return join(array, "");
+ }
/**
* Joins the elements of the provided array into a single string
diff --git a/src/test/org/apache/commons/lang/StringUtilsTest.java b/src/test/org/apache/commons/lang/StringUtilsTest.java
index 09d2b71..415c1dd 100644
--- a/src/test/org/apache/commons/lang/StringUtilsTest.java
+++ b/src/test/org/apache/commons/lang/StringUtilsTest.java
@@ -67,7 +67,7 @@
* @author <a href="mailto:bayard@generationjava.com">Henri Yandell</a>
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
* @author <a href="mailto:ridesmet@users.sourceforge.net">Ringo De Smet</a>
- * @version $Id: StringUtilsTest.java,v 1.1 2002/07/19 03:35:55 bayard Exp $
+ * @version $Id: StringUtilsTest.java,v 1.2 2002/07/23 05:21:27 bayard Exp $
*/
public class StringUtilsTest extends TestCase
{
@@ -142,6 +142,8 @@
public void testJoin()
{
+ assertEquals("concatenate(Object[]) failed",
+ "foobarbaz", StringUtils.concatenate(ARRAY_LIST));
assertEquals("join(Object[], String) failed", TEXT_LIST,
StringUtils.join(ARRAY_LIST, SEPARATOR));
assertEquals("join(Iterator, String) failed", TEXT_LIST,