commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <>
Subject [jira] [Commented] (LANG-701) StringUtils join with var args
Date Fri, 09 Nov 2012 03:06:13 GMT


Gary Gregory commented on LANG-701:

I tried code inspired by this patch and the patch needs more work:

- null input causes NPEs
- null separator should map to ""
- test and main code should be separated and submitted in a diff file vs. trunk.
- the input array should be of Object type, not String, which will cause a stack overflow
with the proposed APIs because the boolean arg will go into the Object array. This would not
happen with a String array but it would greatly reduce the functionality.
- You can start by cloning the join tests. org.apache.commons.lang3.StringUtilsTest

A different approach would be to based the API. on the current APIs.

The need for the endWithSeparator parameter seems of dubious value to me, I think we should
implement this and then discuss the addition of endWithSeparator.

> StringUtils join with var args
> ------------------------------
>                 Key: LANG-701
>                 URL:
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>            Reporter: Gabriele Kahlout
>            Priority: Minor
>             Fix For: 3.x
>         Attachments:
> <code>
> final String apple = "apple";
>         final String banana = "banana";
>         final String orange = "orange";
>         final String expected = apple +  SPACE + banana + SPACE + orange;
>         final String  actual = join(SPACE, apple, banana, orange);
>         final int expLength = expected.length();
>         final int actLength = actual.length();
>         assertEquals(expLength, actLength);
>         assertEquals(expected, actual);
> </code>
> I missed the functionality of joining strings with the space separator in one line. BTW,
why space ' ' not a constant field anywhere?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message