diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index 796d6ff7f..8345711d0 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -4473,7 +4473,7 @@ public class StringUtils { return str; } if (inputLength == 1 && repeat <= PAD_LIMIT) { - return padding(repeat, str.charAt(0)); + return pad(repeat, str.charAt(0)); } int outputLength = inputLength * repeat; @@ -4540,7 +4540,7 @@ public class StringUtils { *
* StringUtils.padding(0, 'e') = "" * StringUtils.padding(3, 'e') = "eee" - * StringUtils.padding(-2, 'e') = IndexOutOfBoundsException + * StringUtils.padding(-2, 'e') throws IndexOutOfBoundsException ** *
Note: this method doesn't not support padding with
@@ -4556,7 +4556,7 @@ public class StringUtils {
* @throws IndexOutOfBoundsException if repeat < 0
* @see #repeat(String, int)
*/
- private static String padding(int repeat, char padChar) throws IndexOutOfBoundsException {
+ public static String pad(int repeat, char padChar) throws IndexOutOfBoundsException {
if (repeat < 0) {
throw new IndexOutOfBoundsException("Cannot pad a negative amount: " + repeat);
}
@@ -4622,7 +4622,7 @@ public class StringUtils {
if (pads > PAD_LIMIT) {
return rightPad(str, size, String.valueOf(padChar));
}
- return str.concat(padding(pads, padChar));
+ return str.concat(pad(pads, padChar));
}
/**
@@ -4734,7 +4734,7 @@ public class StringUtils {
if (pads > PAD_LIMIT) {
return leftPad(str, size, String.valueOf(padChar));
}
- return padding(pads, padChar).concat(str);
+ return pad(pads, padChar).concat(str);
}
/**