Pad a string on the left with spaces till it is at least the specified length. @param s initial string. @param length to pad the string to. @return padded string.
(final String s, final int length)
| 251 | * @return padded string. |
| 252 | */ |
| 253 | public static String padLeft(final String s, final int length) { |
| 254 | final int pad = length - s.length(); |
| 255 | return pad > 0 ? spaces(pad) + s : s; |
| 256 | } |
| 257 | |
| 258 | /** |
| 259 | * Pad a string on the right with spaces till it is at least the specified length. |