You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "David Lavati (Jira)" <ji...@apache.org> on 2020/01/07 13:18:00 UTC

[jira] [Updated] (TEXT-175) WordUtils.capitalizeFully(String) only splits by spaces, instead of any whitespace

     [ https://issues.apache.org/jira/browse/TEXT-175?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Lavati updated TEXT-175:
------------------------------
    Description: 
{color:#172b4d}Due to the performance improvements in TEXT-98, this no longer works as originally designed:{color}
 * {color:#172b4d}{{org.apache.commons.text.WordUtils.capitalizeFully("a\tb\nc")}}{color}
 ** should return "A\t\B\nC", but returns "A\t\b\nc" instead
 * {color:#172b4d}{{org.apache.commons.text.WordUtils.capitalizeFully("a b c")}}{color}
 ** still works as "A B C"

 

A possible option while keeping the improvements would be to create a static collection of whitespace codepoints and
 * either include that into the set, instead of just the single whitespace, as done at [https://github.com/apache/commons-text/commit/fb6d5935451397c561bd52cf1d483975f83b2c7b#diff-9222b0893e00b43fd6519d95e395f9b3R892]
 * or if that touches too many things, call {{capitalize(String,char[])}}  inside capitalizeFully with these chars as delimiters by default.

  was:
{color:#172b4d}Due to the performance improvements in TEXT-98, this no longer works as originally designed:{color}
 * {color:#172b4d}{{org.apache.commons.text.WordUtils.capitalizeFully("a\tb\nc")}}{color}
 ** should return "A\t\B\nC", but returns "A\t\b\nc" instead
 * {color:#172b4d}{{org.apache.commons.text.WordUtils.capitalizeFully("a b c")}}{{}}{color}
 ** still works as "A B C"

 

A possible option while keeping the improvements would be to create a static collection of whitespace codepoints and
 * either include that into the set, instead of just the single whitespace, as done at [https://github.com/apache/commons-text/commit/fb6d5935451397c561bd52cf1d483975f83b2c7b#diff-9222b0893e00b43fd6519d95e395f9b3R892]
 * or if that touches too many things, call {{capitalize(String,char[])}}  inside capitalizeFully with these chars as delimiters by default.


> WordUtils.capitalizeFully(String) only splits by spaces, instead of any whitespace
> ----------------------------------------------------------------------------------
>
>                 Key: TEXT-175
>                 URL: https://issues.apache.org/jira/browse/TEXT-175
>             Project: Commons Text
>          Issue Type: Bug
>    Affects Versions: 1.2
>            Reporter: David Lavati
>            Priority: Minor
>
> {color:#172b4d}Due to the performance improvements in TEXT-98, this no longer works as originally designed:{color}
>  * {color:#172b4d}{{org.apache.commons.text.WordUtils.capitalizeFully("a\tb\nc")}}{color}
>  ** should return "A\t\B\nC", but returns "A\t\b\nc" instead
>  * {color:#172b4d}{{org.apache.commons.text.WordUtils.capitalizeFully("a b c")}}{color}
>  ** still works as "A B C"
>  
> A possible option while keeping the improvements would be to create a static collection of whitespace codepoints and
>  * either include that into the set, instead of just the single whitespace, as done at [https://github.com/apache/commons-text/commit/fb6d5935451397c561bd52cf1d483975f83b2c7b#diff-9222b0893e00b43fd6519d95e395f9b3R892]
>  * or if that touches too many things, call {{capitalize(String,char[])}}  inside capitalizeFully with these chars as delimiters by default.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)