You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2020/10/29 09:10:41 UTC

[GitHub] [commons-lang] HubertWo commented on a change in pull request #635: [LANG-1593] - Common behaviour for StringUtils join APIs when called with char or String delimiter

HubertWo commented on a change in pull request #635:
URL: https://github.com/apache/commons-lang/pull/635#discussion_r514105654



##########
File path: src/main/java/org/apache/commons/lang3/StringUtils.java
##########
@@ -3900,6 +3900,41 @@ public static String join(final byte[] array, final char separator) {
      * @since 3.2
      */
     public static String join(final byte[] array, final char separator, final int startIndex, final int endIndex) {
+        return join(array, Character.toString(separator), startIndex, endIndex);
+    }
+
+    /**
+     * <p>
+     * Joins the elements of the provided array into a single String containing the provided list of elements.
+     * </p>
+     *
+     * <p>
+     * No delimiter is added before or after the list. Null objects or empty strings within the array are represented
+     * by empty strings.
+     * </p>
+     *
+     * <pre>
+     * StringUtils.join(null, *)               = null
+     * StringUtils.join([], *)                 = ""
+     * StringUtils.join([null], *)             = ""
+     * StringUtils.join([1, 2, 3], ';') = "1;2;3"
+     * StringUtils.join([1, 2, 3], null) = "123"
+     * </pre>
+     *
+     * @param array
+     *            the array of values to join together, may be null
+     * @param separator
+     *            the separator String to use
+     * @param startIndex
+     *            the first index to start joining from. It is an error to pass in a start index past the end of the
+     *            array
+     * @param endIndex
+     *            the index to stop joining from (exclusive). It is an error to pass in an end index past the end of
+     *            the array
+     * @return the joined String, {@code null} if null array input
+     * @since 3.2

Review comment:
       My mistake. Fixed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org