[ 
https://issues.apache.org/jira/browse/LANG-485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12697515#action_12697515
 ] 

Matt Benson commented on LANG-485:
----------------------------------

Isn't your example actually doing the opposite of what's been requested, Hen?  
Should we add something like:

public static String joinCamelCase(Object[] array) {
    if (s == null) {
        return null;
    }
    String[] s = new String[array.length];
    for (int i = 0; i < array.length; i++) {
        s[i] = StringUtils.capitalize(String.valueOf(array[i].toLowerCase));
    }
    return join(s);
}

?

Note that it probably doesn't make any sense to provide with-separator variants 
of a camelCase joining method.  If we wanted to be like the other join methods 
provided we could actually delegate the Object[] and Collection<?> versions to 
an Iterator<?> version.

> StringUtils/WordUtils camelize -  underscore functionality
> ----------------------------------------------------------
>
>                 Key: LANG-485
>                 URL: https://issues.apache.org/jira/browse/LANG-485
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Fabian Lange
>
> I recently came across a problem which I expected to be solved already by 
> StringUtils or Word Utils.
> Some input like "MY_TINY_PROPERTY" needed to be converted to a bean name 
> "myTinyProperty".
> The code I wrote for that (far from perfect) looks like this:
> private String toCamelCase(String value, boolean startWithLowerCase) {
>       String[] strings = StringUtils.split(value.toLowerCase(), "_");
>       for (int i = startWithLowerCase ? 1 : 0; i < strings.length; i++){
>               strings[i] = StringUtils.capitalize(strings[i]);
>       }
>       return StringUtils.join(strings);
> }
> The way back would be a bit more complicated.
> If there is consensus that such a function could be useful, I am willing to 
> create a patch. However I can see reasons for not creating such a 
> functionality (especially with the way back) because requirements might 
> differ. What is the commons approach here. Implement something for the 80% 
> case?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to