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

Arun Vinud  commented on TEXT-88:
---------------------------------

Throwing NPE or IAE is a bad idea imho . The capitalize(String, char...) method 
does not make it mandatory to pass delimiters for it to do the minimum work . 
Minimum work meaning either take white space as the default delimiter in the 
case of null (which is well documented) or just capitalize the first character 
in the case of empty delimiter array (which means in the most straight forward 
way that the developer doesn't have any delimiter and doesn't want us to make 
any assumptions whatsoever).  The current implementation doesn't convert the 
first character to title case if we pass an empty delimiter array and the 
reason why I raised this as an issue initially is because the method should 
start the execution and convert the first character to title case and then 
terminate once it parses through the entire string as it won't find any 
delimiters . This makes working of the method more consistent . Ideally I would 
prefer the following behavior.

{code:java}

WordUtils.capitalizeFully("i am fine") --> I Am Fine
WordUtils.capitalizeFully("i am fine", null) --> I Am Fine
WordUtils.capitalizeFully("i am fine", new char[]{}) --> I am fine (Assuming 
the latest change yet to be merged)
{code}

I feel the logic here is pretty straight forward and developer won't have any 
surprise . What you guys think? 


> 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