Skip to content
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-190] Document negative limit for WordUtils abbreviate method #181

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/main/java/org/apache/commons/text/WordUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ public static boolean isDelimiter(final int codePoint, final char[] delimiters)
*
* @param str the string to be abbreviated. If null is passed, null is returned.
* If the empty String is passed, the empty string is returned.
* @param lower the lower limit.
* @param lower the lower limit; negative value is treated as zero.
* @param upper the upper limit; specify -1 if no limit is desired.
* If the upper limit is lower than the lower limit, it will be
* adjusted to be the same as the lower limit.
Expand Down Expand Up @@ -859,7 +859,6 @@ public static boolean isDelimiter(final int codePoint, final char[] delimiters)
public static String abbreviate(final String str, int lower, int upper, final String appendToEnd) {
Validate.isTrue(upper >= -1, "upper value cannot be less than -1");
Validate.isTrue(upper >= lower || upper == -1, "upper value is less than lower value");

if (StringUtils.isEmpty(str)) {
return str;
}
Expand Down