public class Formatter extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static String |
DIVIDER |
protected static String |
SUBDIVIDER |
protected static int |
WIDTH
The width (in characters) of the report output.
|
| Constructor and Description |
|---|
Formatter() |
| Modifier and Type | Method and Description |
|---|---|
static void |
center(String s,
PrintWriter pw)
Centers the given string on the
PrintWriter |
static Vector |
formatDecimal(Collection c,
String pattern)
Returns a collection of decimals based on the given collection but with
the doubles formatted according to the pattern.
|
static int |
maxLength(Collection strings)
Returns the length of the longest string in the collection (0 if the
collection is empty).
|
static Vector |
padLeft(Collection strings)
Returns a collection of strings based on the given collection but with
all strings padded on the left to the length of the longest one.
|
static Vector |
padLeft(Collection doubles,
String pattern)
Returns a collection of doubles based on the given collection but with
the doubles formatted according to the pattern and all entries, both
doubles and string, padded on the left to the length of the longest one.
|
static String |
padLeft(String s,
int length)
Returns a string that is the given string padded on the left to the given length.
|
static Vector |
padRight(Collection strings)
Returns a collection of strings based on the given collection but with
all strings padded on the right to the length of the longest one.
|
static Vector |
padRight(Collection doubles,
String pattern)
Returns a collection of doubles based on the given collection but with
the doubles formatted according to the pattern and all entries, both
doubles and string, padded on the right to the length of the longest one.
|
static String |
padRight(String s,
int length)
Returns a string that is the given string padded on the right to the given length.
|
protected static final int WIDTH
center(String, PrintWriter),
Constant Field Valuesprotected static final String DIVIDER
protected static final String SUBDIVIDER
public static void center(String s, PrintWriter pw)
PrintWriterpublic static Vector formatDecimal(Collection c, String pattern)
public static Vector padLeft(Collection doubles, String pattern)
public static Vector padRight(Collection doubles, String pattern)
public static Vector padLeft(Collection strings)
public static Vector padRight(Collection strings)
public static String padLeft(String s, int length)
public static String padRight(String s, int length)
public static int maxLength(Collection strings)
Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.