Author: ggregory
Date: Fri Apr 22 19:28:58 2011
New Revision: 1095998
URL: http://svn.apache.org/viewvc?rev=1095998&view=rev
Log:
Make the pad method public. I can use this now :) ! The method used to be
private and named padding. It is used internally and covered by unit tests
through leftPad(), rightPad() and repeat().
Modified:
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
Modified:
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
URL:
http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java?rev=1095998&r1=1095997&r2=1095998&view=diff
==============================================================================
---
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
(original)
+++
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
Fri Apr 22 19:28:58 2011
@@ -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 {
* <pre>
* StringUtils.padding(0, 'e') = ""
* StringUtils.padding(3, 'e') = "eee"
- * StringUtils.padding(-2, 'e') = IndexOutOfBoundsException
+ * StringUtils.padding(-2, 'e') throws IndexOutOfBoundsException
* </pre>
*
* <p>Note: this method doesn't not support padding with
@@ -4556,7 +4556,7 @@ public class StringUtils {
* @throws IndexOutOfBoundsException if <code>repeat < 0</code>
* @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);
}
/**