Java Utililty Methods String Align Left

List of utility methods to do String Align Left

Description

The list of methods to do String Align Left are organized into topic(s).

Method

StringalignLeft(CharSequence cs, int width, char c)
align Left
if (null == cs)
    return null;
int length = cs.length();
if (length >= width)
    return cs.toString();
return new StringBuilder().append(cs).append(dup(c, width - length)).toString();
StringalignLeft(String sLine, int iSize)
align Left
if (sLine.length() > iSize) {
    return sLine.substring(0, iSize);
} else {
    return sLine + getWhiteString(iSize - sLine.length());
StringalignLeft(String str, int length)
align Left
return alignLeft(str, length, false);
StringalignLeft(String str, int size)
align Left
return alignLeft(str, size, ' ');
StringalignLeft(String substring, int totalWidth, char fill)
Returns a string of the specified length where the substring is located to the left, padded with a character on the right.
if (substring.length() > totalWidth) {
    return substring.substring(0, totalWidth);
} else {
    return substring + repeat("" + fill, totalWidth - substring.length());
StringalignLeft(String val, char pad, int width)
align Left
if (val == null)
    val = "";
if (val.length() > width) {
    val = "*" + val.substring(0, width - 1);
    return val;
while (val.length() < width)
    val = val + pad;
...