Here you can find the source of lPad(String string, char[] padding, int length)
Parameter | Description |
---|---|
string | the original String to pad. |
padding | a parameter |
length | a parameter |
public static final String lPad(String string, char[] padding, int length)
//package com.java2s; /**/*from w ww . j a v a 2 s .c o m*/ * Converts a line of text into an array of lower case words using a * BreakIterator.wordInstance(). <p> * * This method is under the Jive Open Source Software License and was * written by Mark Imbriaco. * * @param text a String of text to convert into an array of words * @return text broken up into an array of words. */ public class Main { /** * Pads the supplied String with padding chars on the left to the specified length and returns * the result as a new String.; * @param string the original String to pad. * @param padding * @param length * @return */ public static final String lPad(String string, char[] padding, int length) { if (string == null || string.length() > length) { return string; } StringBuffer buf = new StringBuffer(length); buf.append(padding, 0, length - string.length()).append(string); return buf.toString(); } }