List of utility methods to do String Align Right
String | alignRight(CharSequence cs, int width, char c) align Right if (null == cs) return null; int len = cs.length(); if (len >= width) return cs.toString(); return new StringBuilder().append(dup(c, width - len)).append(cs).toString(); |
String | alignRight(final long number, final int length) Trim an integer with leading spaces to a given maximum length. return alignRight("" + number, length); |
String | alignRight(final Object str, final int size) align Right return alignRight(str.toString(), size, ' '); |
String | alignRight(String data) align Right int dataLength = data.length(); String padding = " "; for (int i = 0; i < TOTAL_PAGE_LENGTH - dataLength; i++) { padding = padding + " "; return padding + data; |
String | alignRight(String str, int length, boolean isEllipsis) align Right if (str.length() <= length) { StringBuffer temp = new StringBuffer(length); for (int i = 0; i < (length - str.length()); i++) { temp.append(WHITE_SPACE); temp.append(str); return temp.toString(); } else { ... |
String | alignRight(String str, int size, char padChar) align Right if (str == null) { return null; int pads = size - str.length(); if (pads <= 0) { return str; return alignRight(str, size, String.valueOf(padChar)); ... |
String | alignRight(String substring, int totalWidth, char fill) Returns a string of the specified length where the substring is located to the right, padded with a character on the left. if (substring.length() > totalWidth) { return substring.substring(0, totalWidth); } else { return repeat("" + fill, totalWidth - substring.length()) + substring; |
String | alignRight(String text, int length) Right align a string by adding spaces on the left up to specified length. StringBuffer result = new StringBuffer(); for (int i = 1; i <= (length - text.length()); i++) { result.append(" "); result.append(text); return result.toString(); |
String | alignRight(String val, char pad, int width) align Right if (val.length() > width) { val = val.substring(0, width - 1) + "*"; return val; while (val.length() < width) val = pad + val; return val; |