Package org.tomitribe.crest.help
Class Wrap
- java.lang.Object
-
- org.tomitribe.crest.help.Wrap
-
public class Wrap extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisBlank(java.lang.CharSequence cs)static intlength(java.lang.CharSequence cs)static java.lang.Stringwrap(java.lang.String str, int wrapLength)Wraps a single line of text, identifying words by' '.static java.lang.Stringwrap(java.lang.String str, int wrapLength, java.lang.String newLineStr, boolean wrapLongWords)Wraps a single line of text, identifying words by' '.static java.lang.Stringwrap(java.lang.String str, int wrapLength, java.lang.String newLineStr, boolean wrapLongWords, java.lang.String wrapOn)Wraps a single line of text, identifying words bywrapOn.
-
-
-
Method Detail
-
length
public static int length(java.lang.CharSequence cs)
-
isBlank
public static boolean isBlank(java.lang.CharSequence cs)
-
wrap
public static java.lang.String wrap(java.lang.String str, int wrapLength)Wraps a single line of text, identifying words by
' '.New lines will be separated by the system property line separator. Very long words, such as URLs will not be wrapped.
Leading spaces on a new line are stripped. Trailing spaces are not stripped.
- Parameters:
str- the String to be word wrapped, may be nullwrapLength- the column to wrap the words at, less than 1 is treated as 1- Returns:
- a line with newlines inserted,
nullif null input
-
wrap
public static java.lang.String wrap(java.lang.String str, int wrapLength, java.lang.String newLineStr, boolean wrapLongWords)Wraps a single line of text, identifying words by
' '.Leading spaces on a new line are stripped. Trailing spaces are not stripped.
- Parameters:
str- the String to be word wrapped, may be nullwrapLength- the column to wrap the words at, less than 1 is treated as 1newLineStr- the string to insert for a new line,nulluses the system property line separatorwrapLongWords- true if long words (such as URLs) should be wrapped- Returns:
- a line with newlines inserted,
nullif null input
-
wrap
public static java.lang.String wrap(java.lang.String str, int wrapLength, java.lang.String newLineStr, boolean wrapLongWords, java.lang.String wrapOn)Wraps a single line of text, identifying words by
wrapOn.Leading spaces on a new line are stripped. Trailing spaces are not stripped.
- Parameters:
str- the String to be word wrapped, may be nullwrapLength- the column to wrap the words at, less than 1 is treated as 1newLineStr- the string to insert for a new line,nulluses the system property line separatorwrapLongWords- true if long words (such as URLs) should be wrappedwrapOn- regex expression to be used as a breakable characters, if blank string is provided a space character will be used- Returns:
- a line with newlines inserted,
nullif null input
-
-