org.eclipse.ohf.ihe.atna.audit.syslog.util
Class StringPadder
java.lang.Object
org.eclipse.ohf.ihe.atna.audit.syslog.util.StringPadder
public class StringPadder
- extends java.lang.Object
StringPadder provides left pad and right pad functionality for Strings
|
Method Summary |
static java.lang.String |
leftPad(java.lang.String stringToPad,
java.lang.String padder,
int size)
method to left pad a string with a given string to a given size. |
static java.lang.StringBuffer |
leftPadBuffer(java.lang.String stringToPad,
java.lang.String padder,
int size)
|
static java.lang.String |
rightPad(java.lang.String stringToPad,
java.lang.String padder,
int size)
method to right pad a string with a given string to a given size. |
static java.lang.StringBuffer |
rightPadBuffer(java.lang.String stringToPad,
java.lang.String padder,
int size)
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StringPadder
public StringPadder()
leftPad
public static java.lang.String leftPad(java.lang.String stringToPad,
java.lang.String padder,
int size)
- method to left pad a string with a given string to a given size. This
method will repeat the padder string as many times as is necessary until
the exact specified size is reached. If the specified size is less than the size of
the original string then the original string is returned unchanged.
Example1 - original string "cat", padder string "white", size 8 gives "whitecat".
Example2 - original string "cat", padder string "white", size 15 gives "whitewhitewhcat".
Example3 - original string "cat", padder string "white", size 2 gives "cat".
- Parameters:
stringToPad - The original stringpadder - The string to pad onto the original stringsize - The required size of the new string
- Returns:
- String the newly padded string
leftPadBuffer
public static java.lang.StringBuffer leftPadBuffer(java.lang.String stringToPad,
java.lang.String padder,
int size)
rightPad
public static java.lang.String rightPad(java.lang.String stringToPad,
java.lang.String padder,
int size)
- method to right pad a string with a given string to a given size. This
method will repeat the padder string as many times as is necessary until
the exact specified size is reached. If the specified size is less than the size of
the original string then the original string is returned unchanged.
Example1 - original string "cat", padder string "white", size 8 gives "catwhite".
Example2 - original string "cat", padder string "white", size 15 gives "catwhitewhitewh".
Example3 - original string "cat", padder string "white", size 2 gives "cat".
- Parameters:
stringToPad - The original stringpadder - The string to pad onto the original stringsize - The required size of the new string
- Returns:
- String the newly padded string
rightPadBuffer
public static java.lang.StringBuffer rightPadBuffer(java.lang.String stringToPad,
java.lang.String padder,
int size)