java.lang.Object
net.sourceforge.argparse4j.helper.TextHelper

public final class TextHelper extends Object

This class provides various helper function related to text processing.

The application code should not use this class directly.

  • Field Details

    • LOCALE_ROOT

      public static final Locale LOCALE_ROOT
      Language neutral locale.
    • LINESEP

      public static final String LINESEP
  • Constructor Details

    • TextHelper

      private TextHelper()
  • Method Details

    • concat

      public static <T> String concat(T[] a, int offset, String sep, String start, String end)
    • concat

      public static <T> String concat(T[] a, int offset, String sep)
    • concat

      public static <T> String concat(Collection<T> a, int offset, String sep, String start, String end)
    • concat

      public static <T> String concat(Collection<T> a, int offset, String sep)
    • wrap

      public static String wrap(TextWidthCounter textWidthCounter, String s, int width, int initialOffset, String initialIndent, String subsequentIndent)
    • adjustSpace

      public static StringBuilder adjustSpace(StringBuilder sb, int width, int curWidth)
      Given the maximum line width and current line width in sb, insert white spaces in sb to make it look more "natural". The insertion points are the contiguous block of white spaces. Before the processing, leading and trailing white spaces are removed from sb.
      Parameters:
      sb - String to adjust
      width - maximum line width
      curWidth - current line width
      Returns:
      adjusted sb
    • printHelp

      public static void printHelp(PrintWriter writer, String title, String help, TextWidthCounter textWidthCounter, int width)
    • nonNull

      public static String nonNull(String str)
    • findPrefix

      public static List<String> findPrefix(Collection<String> src, String prefix)
      From src, find string whose prefix is prefix and store them in List and return it.
      Parameters:
      src - collection contains strings to inspect
      prefix - prefix
      Returns:
      List of strings matched