Returns a string, of length at least minLength, consisting of string appended with as many copies of padChar as are necessary to reach that length. For example, padEnd("4.", 5, '0') returns "4.000" padEnd("2010", 3, '!') returns {@code "2
(String string, int minLength, char padChar)
| 118 | * @return the padded string |
| 119 | */ |
| 120 | public static String padEnd(String string, int minLength, char padChar) { |
| 121 | checkNotNull(string); // eager for GWT. |
| 122 | if (string.length() >= minLength) { |
| 123 | return string; |
| 124 | } |
| 125 | StringBuilder sb = new StringBuilder(minLength); |
| 126 | sb.append(string); |
| 127 | for (int i = string.length(); i < minLength; i++) { |
| 128 | sb.append(padChar); |
| 129 | } |
| 130 | return sb.toString(); |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * Returns a string consisting of a specific number of concatenated copies of an input string. For |
nothing calls this directly
no test coverage detected