|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.biojavax.utils.StringTools
public class StringTools
Utility class for formatting strings into regular-sized blocks.
| Method Summary | |
|---|---|
static java.lang.String |
leftIndent(java.lang.String input,
int leftIndent)
Takes an input string and appends spaces to the left. |
static java.lang.String |
leftPad(java.lang.String input,
char padChar,
int totalWidth)
Pads a string to be a certain width by prepending given symbols. |
static java.lang.String |
leftPad(java.lang.String input,
int totalWidth)
Pads a string to be a certain width by prepending spaces. |
static java.lang.String |
rightPad(java.lang.String input,
char padChar,
int totalWidth)
Pads a string to be a certain width by appending given symbols. |
static java.lang.String |
rightPad(java.lang.String input,
int totalWidth)
Pads a string to be a certain width by appending spaces. |
static java.lang.String[] |
wordWrap(java.lang.String input,
java.lang.String sepRegex,
int width)
Word-wraps a string into an array of lines of no more than the given width. |
static void |
writeKeyValueLine(java.lang.String key,
java.lang.String text,
int keyWidth,
int lineWidth,
java.io.PrintStream os)
Writes some text to the output stream in the following format: key text continuation of text where the key/wrappedKey column is keyWidth wide, and the total line width is lineWidth, and the text is split over multiple lines at the nearest occurrence of whitespace. |
static void |
writeKeyValueLine(java.lang.String key,
java.lang.String text,
int keyWidth,
int lineWidth,
java.lang.String sep,
java.io.PrintStream os)
Writes some text to the output stream in the following format: key text continuation of text where the key/wrappedKey column is keyWidth wide, and the total line width is lineWidth, and the text is split over multiple lines at the nearest occurrence of separator sep. |
static void |
writeKeyValueLine(java.lang.String key,
java.lang.String text,
int keyWidth,
int lineWidth,
java.lang.String sep,
java.lang.String wrappedKey,
java.io.PrintStream os)
Writes some text to the output stream in the following format: key text wrappedKey continuation of text where the key/wrappedKey column is keyWidth wide, and the total line width is lineWidth, and the text is split over multiple lines at the nearest occurrence of separator sep. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.lang.String leftIndent(java.lang.String input,
int leftIndent)
input - the input stringleftIndent - the number of spaces to indent it by.
public static java.lang.String leftPad(java.lang.String input,
int totalWidth)
input - the string to pad.totalWidth - the final width required including padded space.
public static java.lang.String leftPad(java.lang.String input,
char padChar,
int totalWidth)
input - the string to pad.padChar - the symbol to pad with.totalWidth - the final width required including padded symbols.
public static java.lang.String rightPad(java.lang.String input,
int totalWidth)
input - the string to pad.totalWidth - the final width required including padded space.
public static java.lang.String rightPad(java.lang.String input,
char padChar,
int totalWidth)
input - the string to pad.padChar - the symbol to pad with.totalWidth - the final width required including padded symbols.
public static java.lang.String[] wordWrap(java.lang.String input,
java.lang.String sepRegex,
int width)
input - the string to formatsepRegex - the regex identifying the break points in the string, to be
compiled using Pattern.width - the width of the lines required
Pattern
public static void writeKeyValueLine(java.lang.String key,
java.lang.String text,
int keyWidth,
int lineWidth,
java.io.PrintStream os)
key - the key to write on the first line onlytext - the text to write outkeyWidth - the width to indent the text by (in which the key will be printed)os - the stream to write the formatted output to
public static void writeKeyValueLine(java.lang.String key,
java.lang.String text,
int keyWidth,
int lineWidth,
java.lang.String sep,
java.io.PrintStream os)
key - the key to write on the first line onlytext - the text to write outkeyWidth - the width to indent the text by (in which the key will be printed)sep - the separator to split the text on if it exceeds the line widthos - the stream to write the formatted output to
public static void writeKeyValueLine(java.lang.String key,
java.lang.String text,
int keyWidth,
int lineWidth,
java.lang.String sep,
java.lang.String wrappedKey,
java.io.PrintStream os)
key - the key to write on the first line onlytext - the text to write outkeyWidth - the width to indent the text by (in which the key will be printed)sep - the separator to split the text on if it exceeds the line widthwrappedKey - the key to print on second and subsequent linesos - the stream to write the formatted output to
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||