Returns padding using the specified delimiter repeated to a given length. StringUtils.padding(0, 'e') = "" StringUtils.padding(3, 'e') = "eee" StringUtils.padding(-2, 'e') = IndexOutOfBoundsException Note: this method doesn't not support padding with <a href="http://www.un
(int repeat, char padChar)
| 596 | * @throws IndexOutOfBoundsException if <code>repeat < 0</code> |
| 597 | */ |
| 598 | private static String padding(int repeat, char padChar) throws IndexOutOfBoundsException { |
| 599 | if (repeat < 0) { |
| 600 | throw new IndexOutOfBoundsException("Cannot pad a negative amount: " + repeat); |
| 601 | } |
| 602 | final char[] buf = new char[repeat]; |
| 603 | for (int i = 0; i < buf.length; i++) { |
| 604 | buf[i] = padChar; |
| 605 | } |
| 606 | return new String(buf); |
| 607 | } |
| 608 | |
| 609 | // Abbreviating |
| 610 | //----------------------------------------------------------------------- |