List of utility methods to do String Left Justify
String | LeftAdjust(String s, int len, char pad) Pad the string s on the right side with pad until len characters.
char[] ca = new char[len]; int k; if (s == null) { k = 0; } else { k = s.length(); for (int i = 0; i < len && i < k; i++) { ... |
String | leftJustify(long v, int width) The leftJustify() method pads a string to a specified length by adding spaces on the right, thus justifying the string to the left margin.
return leftJustify(Long.toString(v), width);
|
String | leftJustify(String s, int maxLength) Left justify a string, and fill to a given length with the blanks. return leftJustify(s, maxLength, ' '); |
String | leftJustify(String sourceString, int targetLen, char pad) left Justify int sourceLen = sourceString.length(); char[] buffer = new char[targetLen]; if (targetLen < sourceLen) { sourceString.getChars(0, targetLen, buffer, 0); } else { int i = 0; while (i < sourceLen) { buffer[i] = sourceString.charAt(i++); ... |
String | leftJustify(String str, int width) left Justify return suffix(str, width, " "); |
String | leftJustify(String string, int width) left Justify StringBuilder buffer = new StringBuilder(); buffer.append(string); int deficit = width - string.length(); for (int i = 0; i < deficit; i++) { buffer.append(' '); return buffer.toString(); |
String | leftJustify(String value, int width) leftJustify left-justifies a String value, space padding to width characters if the string is less than width. StringBuffer sb = new StringBuffer(width); sb.append(value); for (int i = sb.length(); i < width; i++) sb.append(' '); if (sb.length() > width) sb.setLength(width); return sb.toString(); |
String | leftJustifyString(String s, int width) Left justify a string in a fixed-width field, using blanks for padding. return leftJustifyString(s, width, ' '); |
String | leftJustifyText(String originalValue, int length, char padCharacter) left Justify Text String encodedValue = originalValue; if (originalValue == null) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < length; i++) { sb.append(padCharacter); encodedValue = sb.toString(); } else { ... |