Package com.prowidesoftware.swift.utils
Class LineWrapper
- java.lang.Object
-
- com.prowidesoftware.swift.utils.LineWrapper
-
public final class LineWrapper extends java.lang.Object
Static utility class to wrap character data into lines.- Since:
- 9.2.11
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
wrap(java.lang.CharSequence _str, int _width, java.lang.CharSequence _newLineSeq)
Wraps the input sequence_str
to the specified_width
identifying words by space.
Leading spaces on new lines are stripped, while trailing spaces are left unmodified.static java.util.List<java.lang.String>
wrapIntoList(java.lang.CharSequence _str, int _width)
Wraps the input sequence_str
into a list of lines of the specified_width
identifying words by space.
Leading spaces on new lines are stripped, while trailing spaces are left unmodified.static java.util.List<java.lang.String>
wrapIntoListStrict(java.lang.CharSequence _str, int _width)
Wraps the input sequence_str
into a list of lines of the specified_width
Leading spaces on first line are stripped, while the rest of the spaces are left unmodified.
-
-
-
Method Detail
-
wrap
public static java.lang.String wrap(java.lang.CharSequence _str, int _width, java.lang.CharSequence _newLineSeq)
Wraps the input sequence_str
to the specified_width
identifying words by space.
Leading spaces on new lines are stripped, while trailing spaces are left unmodified.- Parameters:
_str
- the input sequence to be wrapped (may be null or empty)_width
- the width to wrap the words at (if less than 1 defaults to 1)_newLineSeq
- the character sequence to insert for a new line,null
uses the system-dependent line separator string- Returns:
- a string wrapped into one or more lines, delimited by
_newLineSeq
,null
if null input
-
wrapIntoList
public static java.util.List<java.lang.String> wrapIntoList(java.lang.CharSequence _str, int _width)
Wraps the input sequence_str
into a list of lines of the specified_width
identifying words by space.
Leading spaces on new lines are stripped, while trailing spaces are left unmodified.- Parameters:
_str
- the input sequence to be wrapped (may be null or empty)_width
- the width to wrap the words at (if less than 1 defaults to 1)- Returns:
- an immutable list of lines, an empty list if input was
null
-
wrapIntoListStrict
public static java.util.List<java.lang.String> wrapIntoListStrict(java.lang.CharSequence _str, int _width)
Wraps the input sequence_str
into a list of lines of the specified_width
Leading spaces on first line are stripped, while the rest of the spaces are left unmodified.- Parameters:
_str
- the input sequence to be wrapped (may be null or empty)_width
- the width to wrap the words at (if less than 1 defaults to 1)- Returns:
- an immutable list of lines, an empty list if input was
null
-
-