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

Gary D. Gregory commented on TEXT-238:
--------------------------------------

I am still -1 on https://github.com/apache/commons-text/pull/70 because it 
clutters up the API with very little value, and we really need to decide what 
to do with this general feature set, see 
https://github.com/apache/commons-text/pull/450/files

Also, the first comment includes the ChatGPT-like link 
https://github.com/apache/commons-text/pull/701?utm_source=chatgpt.com, but the 
PR says you didn't use AI ("I used AI to create any part of, or all of, this 
pull request." is not checked), so which way is it?

TY


> Overload CaseUtils.toCamelCase to default capitalizeFirstLetter=false
> ---------------------------------------------------------------------
>
>                 Key: TEXT-238
>                 URL: https://issues.apache.org/jira/browse/TEXT-238
>             Project: Commons Text
>          Issue Type: Improvement
>    Affects Versions: 1.14.0
>            Reporter: Kushal Dixit
>            Priority: Minor
>
> Right now, {{CaseUtils.toCamelCase(String, boolean, char...)}} always 
> requires specifying the {{capitalizeFirstLetter}} flag.
> In most real-world cases, users just want to convert a string to camelCase 
> with the first letter lowercased by default, as that is basically what 
> camelCase means originally.
> *Proposal:* add a new overload:
> {code:java}
> public static String toCamelCase(String str, char... delimiters) { ... }
> {code}
>  * Since {{delimiters}} is already a varargs parameter, an overload without 
> delimiters is not needed; callers can just omit it.
>  * This overload will also be beneficial for *method references* in JDK 8+, 
> making code like {{list.stream().map(CaseUtils::toCamelCase)}} cleaner.
> *Examples:*
> {code:java}
> CaseUtils.toCamelCase("java-utils", '-');        // javaUtils
> CaseUtils.toCamelCase("convert this string");    // convertThisString
> CaseUtils.toCamelCase("hello_world", '_')        // helloWorld{code}
> *Why it’s useful:*
> Most callers just want the first letter lowercased. Requiring {{false}} every 
> time is unnecessary boilerplate. This overload simplifies the API for the 
> common case while keeping the existing method unchanged for backward 
> compatibility.
> *Note:* Looking for feedback and approval. If this makes sense, I will raise 
> a PR with proper documentation and unit tests.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to