Example usage for org.apache.commons.lang3 StringUtils leftPad

List of usage examples for org.apache.commons.lang3 StringUtils leftPad

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils leftPad.

Prototype

public static String leftPad(final String str, final int size) 

Source Link

Document

Left pad a String with spaces (' ').

The String is padded to the size of size .

 StringUtils.leftPad(null, *)   = null StringUtils.leftPad("", 3)     = "   " StringUtils.leftPad("bat", 3)  = "bat" StringUtils.leftPad("bat", 5)  = "  bat" StringUtils.leftPad("bat", 1)  = "bat" StringUtils.leftPad("bat", -1) = "bat" 

Usage

From source file:se.trixon.mapollage.profile.ProfileBase.java

public String toDebugString() {
    ProfileInfo profileInfo = getProfileInfo();
    int maxLength = profileInfo.getMaxLength() + 3;

    String separator = " : ";
    StringBuilder builder = new StringBuilder("\n");

    builder.append(profileInfo.getTitle()).append("\n");

    profileInfo.getValues().entrySet().forEach((entry) -> {
        String key = entry.getKey();
        String value = entry.getValue();
        builder.append(StringUtils.leftPad(key, maxLength)).append(separator).append(value).append("\n");
    });//from  w  w w.j av  a 2 s  .c  o m

    return builder.toString();
}

From source file:ubic.basecode.math.linearmodels.GenericAnovaResult.java

@Override
public String toString() {
    StringBuilder buf = new StringBuilder();

    buf.append("ANOVA table " + this.getKey() + " \n");

    buf.append(StringUtils.leftPad("\t", 10) + "Df\tSSq\tMSq\tF\tP\n");

    for (String me : this.getMainEffectFactorNames()) {
        if (me.equals(LinearModelSummary.INTERCEPT_COEFFICIENT_NAME)) {
            continue;
        }//from   ww w .  ja  v  a 2s  .c  o m
        AnovaEffect a = mainEffects.get(me);
        buf.append(a + "\n");
    }

    if (hasInteractions()) {
        for (InteractionFactor ifa : interactionEffects.keySet()) {
            AnovaEffect a = this.interactionEffects.get(ifa);
            buf.append(a + "\n");
        }
    }

    buf.append(residual + "\n");

    return buf.toString();
}

From source file:Utils.Progress.TextProgress.java

public void done(int number) {
    done += number;/*from   w w w.j a  va 2 s.  c  om*/
    System.out.println("\t" + StringUtils.leftPad(Long.toString(done), tl) + "/" + total);
}