kinow commented on pull request #179:
URL: https://github.com/apache/commons-text/pull/179#issuecomment-717133252


   @ZhuGongpu great catch! Thanks for the pull request, and for updating the 
tests.
   
   I wonder if we could improve the Javadocs too? Maybe one more `<p>` 
paragraph with something like "An empty String with only delimiter characters, 
removes the delimiters", or something like that. And also include an example 
from the tests in the `<pre>` showing what we mean by the text in the new 
paragraph.
   
   We will also need a JIRA for the changelog in the next release. Could you 
create one in https://issues.apache.org/jira/projects/TEXT/issues and update 
the title of this PR to `[TEXT-????] Fix CaseUtils`, please?
   
   @garydgregory, @chtompki, and others, I think this is a legit issue. Imagine 
you have two combo boxes in a web page, with name and surname, and for whatever 
reason you want to camel case the two.
   
   In `master`, if the user selects `name="Randy"` and `surname="Marsh"`, 
`CaseUtils.toCamelCase(String.format("%s %s", name, surname), false)` returns 
"randyMarsh".
   
   But if the user does not select values, and there is no validation in the 
web page or on the server side, then the code called would have `name=""` and 
`surname=""`, and the invocation be `CaseUtils.toCamelCase(String.format("%s 
%s", name, surname), false)` which results in `" "` (an empty space). It's 
worse if you have multiple spaces.
   
   IMO, we should be consistent and always remove the delimiters (unless the 
given `str` is `null`, as per docs).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to