You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/09/26 20:30:28 UTC
[GitHub] [commons-text] angusdev opened a new pull request, #360: TEXT-217 - Add CaseUtils.toSnakeCase and CaseUtils.toKebabCase
angusdev opened a new pull request, #360:
URL: https://github.com/apache/commons-text/pull/360
add to_snake_case and to-kebab-case
--
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.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-text] angusdev commented on a diff in pull request #360: TEXT-217 - Add CaseUtils.toSnakeCase and CaseUtils.toKebabCase
Posted by GitBox <gi...@apache.org>.
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.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-text] angusdev commented on pull request #360: TEXT-217 - Add CaseUtils.toSnakeCase and CaseUtils.toKebabCase
Posted by GitBox <gi...@apache.org>.
angusdev commented on PR #360:
URL: https://github.com/apache/commons-text/pull/360#issuecomment-1281900340
Update. Use codePointCount instead of string length
--
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.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-text] garydgregory commented on a diff in pull request #360: TEXT-217 - Add CaseUtils.toSnakeCase and CaseUtils.toKebabCase
Posted by GitBox <gi...@apache.org>.
garydgregory commented on code in PR #360:
URL: https://github.com/apache/commons-text/pull/360#discussion_r980501642
##########
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:
The number of code points might not the same as the number of chars.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org