Makes sure "..." is the same all over this method.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@922448 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory 2010-03-12 22:59:21 +00:00
parent 655050f6fd
commit 8a8859cb88
1 changed files with 5 additions and 4 deletions

View File

@ -5524,16 +5524,17 @@ public static String abbreviate(String str, int offset, int maxWidth) {
if ((str.length() - offset) < (maxWidth - 3)) {
offset = str.length() - (maxWidth - 3);
}
final String abrevMarker = "...";
if (offset <= 4) {
return str.substring(0, maxWidth - 3) + "...";
return str.substring(0, maxWidth - 3) + abrevMarker;
}
if (maxWidth < 7) {
throw new IllegalArgumentException("Minimum abbreviation width with offset is 7");
}
if ((offset + (maxWidth - 3)) < str.length()) {
return "..." + abbreviate(str.substring(offset), maxWidth - 3);
return abrevMarker + abbreviate(str.substring(offset), maxWidth - 3);
}
return "..." + str.substring(str.length() - (maxWidth - 3));
return abrevMarker + str.substring(str.length() - (maxWidth - 3));
}
/**