List of usage examples for org.apache.commons.lang StringUtils rightPad
public static String rightPad(String str, int size, String padStr)
Right pad a String with a specified String.
From source file:wzw.util.NumberUtils.java
/** * @param args/*from ww w . java2 s. c o m*/ */ public static void main(String[] args) { // TODO Auto-generated method stub //test add System.out.println( StringUtils.rightPad("NumberUtils.add(1.2, 1.32) ", 35, " ") + "=" + NumberUtils.add(1.2, 1.32)); System.out.println( StringUtils.rightPad("NumberUtils.add(1, 1.122) ", 35, " ") + "=" + NumberUtils.add(1, 1.122)); //test sub System.out.println( StringUtils.rightPad("NumberUtils.sub(1.32, 1.2) ", 35, " ") + "=" + NumberUtils.sub(1.32, 1.2)); //test mul System.out.println( StringUtils.rightPad("NumberUtils.mul(2, 1.32) ", 35, " ") + "=" + NumberUtils.mul(2, 1.32)); //test div System.out.println( StringUtils.rightPad("NumberUtils.div(1.32, 2) ", 35, " ") + "=" + NumberUtils.div(1.32, 2)); System.out.println( StringUtils.rightPad("NumberUtils.div(1.32, 2, 1) ", 35, " ") + "=" + NumberUtils.div(1.32, 2, 1)); //test round System.out.println(StringUtils.rightPad("NumberUtils.round(1.32525, 2) ", 35, " ") + "=" + NumberUtils.round(1.32525, 2)); System.out.println(StringUtils.rightPad("NumberUtils.round(1.32525, 3) ", 35, " ") + "=" + NumberUtils.round(1.32525, 3)); }