The list of methods to do String Align Right are organized into topic(s).
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(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 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();