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:
parent
655050f6fd
commit
8a8859cb88
|
@ -5524,16 +5524,17 @@ public static String abbreviate(String str, int offset, int maxWidth) {
|
||||||
if ((str.length() - offset) < (maxWidth - 3)) {
|
if ((str.length() - offset) < (maxWidth - 3)) {
|
||||||
offset = str.length() - (maxWidth - 3);
|
offset = str.length() - (maxWidth - 3);
|
||||||
}
|
}
|
||||||
|
final String abrevMarker = "...";
|
||||||
if (offset <= 4) {
|
if (offset <= 4) {
|
||||||
return str.substring(0, maxWidth - 3) + "...";
|
return str.substring(0, maxWidth - 3) + abrevMarker;
|
||||||
}
|
}
|
||||||
if (maxWidth < 7) {
|
if (maxWidth < 7) {
|
||||||
throw new IllegalArgumentException("Minimum abbreviation width with offset is 7");
|
throw new IllegalArgumentException("Minimum abbreviation width with offset is 7");
|
||||||
}
|
}
|
||||||
if ((offset + (maxWidth - 3)) < str.length()) {
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue