public final class MyFixedLengthFormatter
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
appendBlanks(int length,
java.lang.String buffer)
Appends blanks to a String such that the string length becomes equal to a given length
|
static void |
appendBlanks(int length,
java.lang.StringBuffer buffer) |
static void |
appendZeroes(int length,
java.lang.StringBuffer buffer) |
static java.lang.String |
prependBlanks(int length,
java.lang.String buffer)
Prepends a specified number of blanks to a String
|
static java.lang.String |
prependZeroes(int length,
java.lang.String buffer) |
static void |
prependZeroes(int length,
java.lang.StringBuffer buffer) |
public static java.lang.String appendBlanks(int length, java.lang.String buffer)
length
- The length that the string has to becomebuffer
- The string value to which blanks have to be appendedpublic static void appendBlanks(int length, java.lang.StringBuffer buffer)
length
- the length to pad the buffer tobuffer
- the buffer to pad with blankspublic static void appendZeroes(int length, java.lang.StringBuffer buffer)
length
- the total length that the number must have after formattingbuffer
- the number to be formattedpublic static java.lang.String prependBlanks(int length, java.lang.String buffer)
length
- The number of blanks to prependbuffer
- The buffer where blanks have to be prependedpublic static java.lang.String prependZeroes(int length, java.lang.String buffer)
length
- the total length that the number must have after formattingbuffer
- the number to be formattedpublic static void prependZeroes(int length, java.lang.StringBuffer buffer)
length
- the total length that the number must have after formattingbuffer
- the number to be formatted