public class StringUtils
extends Object
String
s.Modifier and Type | Method and Description |
---|---|
static String |
indent(String toIndent,
String indentWith)
Prepends every line of a
String with another String . |
static String |
wrapString(String toWrap,
int maxLineLength)
Word-wraps a
String (ensures it fits within a certain width). |
public static String wrapString(String toWrap, int maxLineLength)
String
(ensures it fits within a certain width).
Note: this does not work properly with text containing tab characters
(\t
).toWrap
- The String
to be word-wrapped.maxLineLength
- How long a line can reach before it's split in two.
toWrap
wrapped to maxLineLength
width.
public static String indent(String toIndent, String indentWith)
String
with another String
.
toIndent
- The String
to be indented.indentWith
- The String
to prefix each line with. For
example, a bulleted list could be created by passing in
" * "
.
toIndent
with every line prepended with
indentWith
.