Class OptionUtils
java.lang.Object
com.aspectran.shell.command.option.OptionUtils
Contains useful helper methods for classes within this package.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
createPadding
(int len) Return a String of padding of lengthlen
.static int
findWrapPos
(String text, int width, int startPos) Finds the next text wrap position afterstartPos
for the text intext
with the column widthwidth
.static String
Remove the trailing whitespace from the specified String.
-
Constructor Details
-
OptionUtils
public OptionUtils()
-
-
Method Details
-
createPadding
Return a String of padding of lengthlen
.- Parameters:
len
- the length of the String of padding to create- Returns:
- the String of padding
-
rtrim
Remove the trailing whitespace from the specified String.- Parameters:
s
- the String to remove the trailing padding from- Returns:
- the String of without the trailing padding
-
findWrapPos
Finds the next text wrap position afterstartPos
for the text intext
with the column widthwidth
. The wrap point is the last position before startPos+width having a whitespace character (space, \n, \r). If there is no whitespace character before startPos+width, it will return startPos+width.- Parameters:
text
- the text being searched for the wrap positionwidth
- width of the wrapped textstartPos
- position from which to start the lookup whitespace character- Returns:
- position on which the text must be wrapped or -1 if the wrap position is at the end of the text
-