[
https://issues.apache.org/jira/browse/TEXT-217?focusedWorklogId=812274&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-812274
]
ASF GitHub Bot logged work on TEXT-217:
---------------------------------------
Author: ASF GitHub Bot
Created on: 26/Sep/22 22:08
Start Date: 26/Sep/22 22:08
Worklog Time Spent: 10m
Work Description: angusdev commented on code in PR #360:
URL: https://github.com/apache/commons-text/pull/360#discussion_r980542958
##########
src/main/java/org/apache/commons/text/CaseUtils.java:
##########
@@ -96,11 +96,100 @@ public static String toCamelCase(String str, final boolean
capitalizeFirstLetter
return new String(newCodePoints, 0, outOffset);
}
+ private static String toDelimiterCase(String str, final char newDelimiter,
final char... delimiters) {
+ if (StringUtils.isEmpty(str)) {
+ return str;
+ }
+ str = str.toLowerCase();
+ final int strLen = str.length();
+ final int[] newCodePoints = new int[strLen];
Review Comment:
I'm no expert in Unicode, please see my understanding is correct or not:
Change to `final int[] newCodePoints = new int[str.codePointCount(0,
strLen)];`. But since code points <= number of chars, there will be no test
case to validate this change. Also will change `toCamelCase()` as well.
Issue Time Tracking
-------------------
Worklog Id: (was: 812274)
Time Spent: 50m (was: 40m)
> Snake case utility method: CaseUtils.toSnakeCase(....)
> ------------------------------------------------------
>
> Key: TEXT-217
> URL: https://issues.apache.org/jira/browse/TEXT-217
> Project: Commons Text
> Issue Type: New Feature
> Affects Versions: 1.9
> Reporter: Adil Iqbal
> Priority: Major
> Fix For: 1.9
>
> Time Spent: 50m
> Remaining Estimate: 0h
>
> Requesting a feature to convert any string to snake case, as per
> CaseUtils.toCamelCase(...)
> *Rationale:*
> As per the OpenAPI Specification 3.0, keys should be in snake case. There is
> currently no common utility that can be used to accomplish that task.
> Any interaction between Java and Python is hindered, since Python uses snake
> case as a best practice.
> *Feature Set Requested:*
> All features currently included in CaseUtils.toCamelCase(...) sans
> capitalization flag. As you know, the capitalization flag was implemented to
> support PascalCase, which is a convention even in Java, for many situations.
> There is no equivalent for snake case.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)