Here you can find the source of leftPadding(final StringBuffer strBuf, final int bufLen, final char fill)
Parameter | Description |
---|---|
strBuf | Target buffer |
bufLen | Buffer length |
fill | Char to fill |
public static StringBuffer leftPadding(final StringBuffer strBuf, final int bufLen, final char fill)
//package com.java2s; /*/*ww w. j ava 2 s. co m*/ * Utility.java * * HomePage : http://www.codeproject.com/csharp/TraceTool.asp * Download : http://sourceforge.net/projects/tracetool/ * See License.txt for license information * * Author : Thierry Parent * Version : 12.3 * * Provide some utility functions */ public class Main { /** * Left Pad Stringbuffer with special char * @param strBuf Target buffer * @param bufLen Buffer length * @param fill Char to fill * @return a padded StringBuffer */ public static StringBuffer leftPadding(final StringBuffer strBuf, final int bufLen, final char fill) { while (strBuf.length() < bufLen) strBuf.insert(0, fill); return strBuf; } }