public class StringWrapper
extends java.lang.Object
| Constructor and Description |
|---|
StringWrapper() |
| Modifier and Type | Method and Description |
|---|---|
static void |
printWrappedString(java.io.PrintStream stream,
java.lang.String string,
int maxWidth) |
static java.lang.String[] |
wrapString(java.lang.String str,
int maxWidth,
java.lang.String[] output)
Splits the given string into lines using on any embedded newlines, and wrapping the text as needed to conform to
the given maximum line width.
|
static java.lang.Iterable<java.lang.String> |
wrapStringOnBreaks(java.lang.String string,
int maxWidth)
Splits the given string into lines of maximum width maxWidth.
|
public static java.lang.Iterable<java.lang.String> wrapStringOnBreaks(@Nonnull
java.lang.String string,
int maxWidth)
string - The string to splitmaxWidth - The maximum length of any linepublic static java.lang.String[] wrapString(@Nonnull
java.lang.String str,
int maxWidth,
@Nullable
java.lang.String[] output)
str - The string to splitmaxWidth - The maximum length of any lineoutput - If given, try to use this array as the return value. If there are more values than will fit
into the array, a new array will be allocated and returned, while the given array will be filled
with as many lines as would fit.public static void printWrappedString(@Nonnull
java.io.PrintStream stream,
@Nonnull
java.lang.String string,
int maxWidth)