Posted By

Caliban on 12/06/07


Tagged

java Jakarta


Versions (?)

Right pad a String with spaces using Jakarta Commons Lang


 / Published in: Java
 

  1. import org.apache.commons.lang.StringUtils;
  2.  
  3. public class TestRightPad
  4. {
  5. /**
  6.   * @param args
  7.   */
  8. public static void main( String[] args )
  9. {
  10. String text = StringUtils.rightPad( "Key", 15 ) + ": " + "Value";
  11. // prints Key : Value
  12. System.out.println( text );
  13. }
  14. }

Report this snippet  

You need to login to post a comment.