commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TEXT-88) WordUtils.capitalizeFully behaves in a counterintuitive manner with empty delimiter array.
Date Wed, 14 Jun 2017 09:53:00 GMT

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

Gilles commented on TEXT-88:
----------------------------

bq. reply appropriately

When a library method gets {{null}}, it cannot know whether it was intentional or not.
I'd certainly prefer being warned that something is shaky (through NPE) rather than the program
continuing a computation that is not what I intended.

The "feature" may be fine at the _application_ level (where context in better known).

bq. mentioning behavior in Javadoc of each method is good enough to tell users how it will
work.

It will not save them from a programming error.
Why is it not sufficient to have syntactic sugar:
{code}
WordUtils.capitalizeFully(string)
{code}
that is documented to behave like 
{code}
WordUtils.capitalizeFully(string, delim)
{code}
where "delim" is e.g. whitespace?


> 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)

Mime
View raw message