|
||||||||||
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 String |
leftIndent(String input,
int leftIndent)
Takes an input string and appends spaces to the left. |
static String |
leftPad(String input,
char padChar,
int totalWidth)
Pads a string to be a certain width by prepending given symbols. |
static String |
leftPad(String input,
int totalWidth)
Pads a string to be a certain width by prepending spaces. |
static String |
rightPad(String input,
char padChar,
int totalWidth)
Pads a string to be a certain width by appending given symbols. |
static String |
rightPad(String input,
int totalWidth)
Pads a string to be a certain width by appending spaces. |
static String[] |
wordWrap(String input,
String sepRegex,
int width)
Word-wraps a string into an array of lines of no more than the given width. |
static void |
writeKeyValueLine(String key,
String text,
int keyWidth,
int lineWidth,
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(String key,
String text,
int keyWidth,
int lineWidth,
String sep,
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(String key,
String text,
int keyWidth,
int lineWidth,
String sep,
String wrappedKey,
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 String leftIndent(String input, int leftIndent)
input
- the input stringleftIndent
- the number of spaces to indent it by.
public static String leftPad(String input, int totalWidth)
input
- the string to pad.totalWidth
- the final width required including padded space.public static String leftPad(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 String rightPad(String input, int totalWidth)
input
- the string to pad.totalWidth
- the final width required including padded space.public static String rightPad(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 String[] wordWrap(String input, 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(String key, String text, int keyWidth, int lineWidth, 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 topublic static void writeKeyValueLine(String key, String text, int keyWidth, int lineWidth, String sep, 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 topublic static void writeKeyValueLine(String key, String text, int keyWidth, int lineWidth, String sep, String wrappedKey, 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 |