[ 
https://issues.apache.org/jira/browse/TEXT-88?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16046828#comment-16046828
 ] 

Amey Jadiye commented on TEXT-88:
---------------------------------

agreed, its a obvious bug looking at code.

{code:java}
 public static String capitalizeFully(String str, final char... delimiters) {
        final int delimLen = delimiters == null ? -1 : delimiters.length;
        if (StringUtils.isEmpty(str) || delimLen == 0) { // BUG IS HERE, if 
length is 0 , returning str as it is.
            return str;
        }
        str = str.toLowerCase();
        return capitalize(str, delimiters);
    }


{code}

FIX : 

{code:java}
public static String capitalizeFully(String str, final char... delimiters) {
        final int delimLen = delimiters == null ? -1 : delimiters.length;
        if (StringUtils.isEmpty(str)) {
            return str;
        }
        if (delimLen == 0){
                return capitalize(str.toLowerCase(), null);
        }
        str = str.toLowerCase();
        return capitalize(str, delimiters);
    }
{code}


> WordUtils.capitalizeFully behaves in a counterintuitive manner with empty 
> delimiter array.
> ------------------------------------------------------------------------------------------
>
>                 Key: TEXT-88
>                 URL: https://issues.apache.org/jira/browse/TEXT-88
>             Project: Commons Text
>          Issue Type: Bug
>            Reporter: Rob Tompkins
>
> As discussed in TEXT-85, it seems that 
> {code:java}
> WordUtils.capitalizeFully("i am fine", new char[]{}) // --> i am fine
> {code}
> Both Sebb and Arun think that this is odd and that the letter "i" should have 
> been capitalized resulting in the output {{I am fine}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to