List of utility methods to do String Pad Right
byte[] | rightPad(byte[] bytes, int length, byte padByte) right Pad if (bytes == null) { return null; } else if (bytes.length >= length) { return bytes; byte[] newBytes = new byte[length]; System.arraycopy(bytes, 0, newBytes, 0, bytes.length); for (int i = bytes.length; i < length; i++) { ... |
String | rightPad(final String input, final int size) right Pad int pads = size - input.length(); if (pads <= 0) return input; StringBuilder out = new StringBuilder(input); for (int i = pads; i > 0; i--) out.append(' '); return out.toString(); |
String | rightPad(final String str, final int size, final char padChar) Right pad a String with a specified character. The String is padded to the size of size . StringUtils.rightPad(null, *, *) = null StringUtils.rightPad("", 3, 'z') = "zzz" StringUtils.rightPad("bat", 3, 'z') = "bat" StringUtils.rightPad("bat", 5, 'z') = "batzz" StringUtils.rightPad("bat", 1, 'z') = "bat" StringUtils.rightPad("bat", -1, 'z') = "bat" if (str == null) { return null; final int pads = size - str.length(); if (pads <= 0) { return str; if (pads > PAD_LIMIT) { ... |
String | rightPad(String _str, int _size, char _padChar) right Pad if (_str == null) { return null; int pads = _size - _str.length(); if (pads <= 0) { return _str; return _str.concat(padding(pads, _padChar)); ... |
String | rightPad(String csIn, int nRequiredLength, char cFill) right Pad String csOut = new String(); int nLgStringIn = csIn.length(); int nNbcharToPad = nRequiredLength - nLgStringIn; if (nNbcharToPad > 0) { csOut = csIn; for (int n = 0; n < nNbcharToPad; n++) { csOut = csOut + cFill; } else csOut = csIn.substring(0, nRequiredLength); return csOut; |
String | rightPad(String field, char padding, int width) right Pad String answer; if (field.length() < width) { answer = field + fill(padding, width - field.length()); } else { answer = field; return answer; |
String | rightPad(String in, char padding, int length) right Pad String out = ""; int toPad = length - in.length(); if (toPad < 0) { throw new IllegalArgumentException("Input string longer than requested length"); out = in + getStringRepetition(padding + "", toPad); return out; |
String | rightPad(String in, int len, String pad) right Pad for (int i = 0; i < len; i++) { in += pad; return in; |
String | rightPad(String input, char padding, int length) right Pad if (nullOrEmpty(input)) input = ""; if (input.length() >= length) return input; String padString = createPad(padding, length - input.length()); return input.concat(padString); |
String | rightPad(String input, int length, char pad) Right pad a string with the specified character, if the string length is less then the specified length. if (input.length() < length) { StringBuilder sb = new StringBuilder(); sb.append(input); for (int i = 0, len = length - input.length(); i < len; i++) { sb.append(pad); return sb.toString(); return input; |