New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TEXT-39 WordUtils should use toXxxxCase(int) rather than toXxxxCase(char) #39
Conversation
@chtompki @PascalSchumacher @kinow , please review changes and let me know if more improvements needed here else I have verified everything on my end, all existing test cases are passing with changes. |
Looks good I think. The code points is handled with the Character#charCount, so it increments with 1 or 2 (when it finds a surrogate pair). I noticed that if I pass a String such as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for merging.
for (int i = 0; i < buffer.length; i++) { | ||
final char ch = buffer[i]; | ||
if (isDelimiter(ch, delimiters)) { | ||
for (int index = 0; index < str.length();) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
str.length();
could be replaced with strLen
initialized above (just from a performance standpoint). Note, this is extra nit-picky and need not block the PR.
for (int i = 0; i < buffer.length; i++) { | ||
final char ch = buffer[i]; | ||
if (isDelimiter(ch, delimiters)) { | ||
for (int index = 0; index < str.length();) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here with str.length();
.
final char ch = buffer[i]; | ||
if (Character.isUpperCase(ch)) { | ||
buffer[i] = Character.toLowerCase(ch); | ||
for (int index = 0; index < strLen;) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, this is what I was thinking.
* @param delimiters the delimiters | ||
* @return true if it is a delimiter | ||
*/ | ||
private static boolean isDelimiter(final int codePoint, final char[] delimiters) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to not make the signature here:
public static String isDelimiter(final int codePoint, final char... delimiters);
I suppose we could have a debate about making this public v. private, but I'm not sure I see a reason for it to be exclusively private other than not needing to write as much documentation. I'm open to either way here, it was just something that crossed my mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @chtompki for pointing this, I created method first then generated it with eclipse by default it generated private so missed this one, I think this should be public, and there is one more overloaded method with same name also have to be public.
@kinow @PascalSchumacher @britter , thoughts ?
private static boolean isDelimiter(final char ch, final char[] delimiters)
Am willing to merge. Just waiting to see what other folks think about what I said here. |
Same here regarding make that method public :-) |
I think most of us are ok with making it |
Looks good. Will pull this in tonight. |
No description provided.