commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang StringUtils.java
Date Tue, 23 Jul 2002 05:21:28 GMT
bayard      2002/07/22 22:21:28

  Modified:    lang/src/test/org/apache/commons/lang StringUtilsTest.java
               lang/src/java/org/apache/commons/lang StringUtils.java
  Log:
  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.
  
  Revision  Changes    Path
  1.2       +3 -1      jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsTest.java
  
  Index: StringUtilsTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StringUtilsTest.java	19 Jul 2002 03:35:55 -0000	1.1
  +++ StringUtilsTest.java	23 Jul 2002 05:21:27 -0000	1.2
  @@ -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,
  
  
  
  1.4       +11 -1     jakarta-commons/lang/src/java/org/apache/commons/lang/StringUtils.java
  
  Index: StringUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/StringUtils.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StringUtils.java	21 Jul 2002 20:19:50 -0000	1.3
  +++ StringUtils.java	23 Jul 2002 05:21:28 -0000	1.4
  @@ -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
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message