kinow commented on code in PR #903:
URL: https://github.com/apache/commons-lang/pull/903#discussion_r1067442485
##########
src/main/java/org/apache/commons/lang3/CharUtils.java:
##########
@@ -114,6 +114,33 @@ public static Character toCharacterObject(final String
str) {
return StringUtils.isEmpty(str) ? null :
Character.valueOf(str.charAt(0));
}
+ /**
+ * <p>Converts the String to a Character using the first character,
returning a
+ * default value if {@code null} or empty is passed in.</p>
+ *
+ * <p>For ASCII 7 bit characters, this uses a cache that will return the
+ * same Character object each time.</p>
+ *
+ * <pre>
+ * CharUtils.toCharacterObject(null, 'A') = 'A'
+ * CharUtils.toCharacterObject("", 'A') = 'A'
+ * CharUtils.toCharacterObject("A", 'D') = 'A'
+ * CharUtils.toCharacterObject("BA", 'D') = 'B'
+ * </pre>
+ *
+ * @param str the character to convert
Review Comment:
I think `str` is not a character too, sorry forgot to review the text in the
javadocs.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]