Class OptionUtils

java.lang.Object
com.aspectran.shell.command.option.OptionUtils

public final class OptionUtils extends Object
Contains useful helper methods for classes within this package.
  • Constructor Details

    • OptionUtils

      public OptionUtils()
  • Method Details

    • createPadding

      @NonNull public static String createPadding(int len)
      Return a String of padding of length len.
      Parameters:
      len - the length of the String of padding to create
      Returns:
      the String of padding
    • rtrim

      public static String rtrim(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(@NonNull String text, int width, int startPos)
      Finds the next text wrap position after startPos for the text in text with the column width width. 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 position
      width - width of the wrapped text
      startPos - 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