|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.overzealous.remark.util.StringUtils
public class StringUtils
A small collection of utilities for manipulating strings.
Field Summary | |
---|---|
static int |
ALIGN_CENTER
Represents centered alignment. |
static int |
ALIGN_LEFT
Represents left alignment. |
static int |
ALIGN_RIGHT
Represents right alignment. |
Constructor Summary | |
---|---|
StringUtils()
|
Method Summary | |
---|---|
static void |
align(PrintWriter output,
String s,
int width,
char paddingChar,
int alignment)
Pads out a left-, right-, or center-aligned string using the specified character up to the specified width. |
static void |
align(PrintWriter output,
String s,
int width,
int alignment)
Pads out a left-, right-, or center-aligned string using spaces up to the specified width. |
static String |
align(String s,
int width,
char paddingChar,
int alignment)
Pads out a left-, right-, or center-aligned string using the specified character up to the specified width. |
static String |
align(String s,
int width,
int alignment)
Pads out a left-, right-, or center-aligned string using spaces up to the specified width. |
static String |
multiply(char c,
int count)
Duplicates the given character count times. |
static void |
multiply(PrintWriter output,
char c,
int count)
Duplicates the given character count times to the Writer. |
static void |
multiply(PrintWriter output,
String s,
int count)
Duplicates the given string count times to the Writer. |
static String |
multiply(String s,
int count)
Duplicates the given string count times. |
static void |
prependEachLine(PrintWriter output,
String s,
String prependWith)
Prepends a specific string to the front of each line of an input string. |
static String |
prependEachLine(String s,
String prependWith)
Prepends a specific string to the front of each line of an input string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int ALIGN_LEFT
public static final int ALIGN_CENTER
public static final int ALIGN_RIGHT
Constructor Detail |
---|
public StringUtils()
Method Detail |
---|
public static String align(String s, int width, int alignment)
s
- String to padwidth
- Minimum width of final stringalignment
- How to align the string < 0 means left, 0 means center, and > 0 means right
public static String align(String s, int width, char paddingChar, int alignment)
s
- String to padwidth
- Minimum width of final stringpaddingChar
- Character to pad withalignment
- How to align the string < 0 means left, 0 means center, and > 0 means right
public static void align(PrintWriter output, String s, int width, int alignment)
output
- Writer to output the centered string tos
- String to padwidth
- Minimum width of final stringalignment
- How to align the string < 0 means left, 0 means center, and > 0 means rightpublic static void align(PrintWriter output, String s, int width, char paddingChar, int alignment)
output
- Writer to output the centered string tos
- String to padwidth
- Minimum width of final stringpaddingChar
- Character to pad withalignment
- How to align the string < 0 means left, 0 means center, and > 0 means rightpublic static String multiply(char c, int count)
count
times.
If count
is less than or equal to 0, the empty string is returned.
c
- Character to duplicatecount
- Number of times to duplicate
public static String multiply(String s, int count)
count
times.
If count
is less than or equal to 0, the empty string is returned.
s
- String to duplicatecount
- Number of times to duplicate
public static void multiply(PrintWriter output, char c, int count)
count
times to the Writer.
If count
is less than or equal to 0, this is a no-op.
output
- Writer to receive duplicated resultsc
- Character to duplicatecount
- Number of times to duplicatepublic static void multiply(PrintWriter output, String s, int count)
count
times to the Writer.
If count
is less than or equal to 0, this is a no-op.
output
- Writer to receive duplicated resultss
- String to duplicatecount
- Number of times to duplicatepublic static String prependEachLine(String s, String prependWith)
'\n'
, '\r'
, or '\f'
character.
s
- The input string.prependWith
- The string to prepend to each line.
public static void prependEachLine(PrintWriter output, String s, String prependWith)
'\n'
, '\r'
, or '\f'
character.
output
- The writer to recieve the modified string.s
- The input string.prependWith
- The string to prepend to each line.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |