Right pad a String with spaces using Jakarta Commons Lang


/ Published in: Java
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.