Class OptionUtils
- java.lang.Object
-
- com.aspectran.shell.command.option.OptionUtils
-
public final class OptionUtils extends java.lang.Object
Contains useful helper methods for classes within this package.
-
-
Constructor Summary
Constructors Constructor Description OptionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
createPadding(int len)
Return a String of padding of lengthlen
.static int
findWrapPos(java.lang.String text, int width, int startPos)
Finds the next text wrap position afterstartPos
for the text intext
with the column widthwidth
.static java.lang.String
rtrim(java.lang.String s)
Remove the trailing whitespace from the specified String.
-
-
-
Method Detail
-
createPadding
public static java.lang.String createPadding(int len)
Return a String of padding of lengthlen
.- Parameters:
len
- the length of the String of padding to create- Returns:
- the String of padding
-
rtrim
public static java.lang.String rtrim(java.lang.String s)
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
public static int findWrapPos(java.lang.String text, int width, int startPos)
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
-
-