java.lang.Object
net.sourceforge.argparse4j.helper.TextHelper
This class provides various helper function related to text processing.
The application code should not use this class directly.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringBuilderadjustSpace(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".static <T> Stringconcat(Collection<T> a, int offset, String sep) static <T> Stringconcat(Collection<T> a, int offset, String sep, String start, String end) static <T> Stringstatic <T> StringfindPrefix(Collection<String> src, String prefix) From src, find string whose prefix is prefix and store them in List and return it.static Stringstatic voidprintHelp(PrintWriter writer, String title, String help, TextWidthCounter textWidthCounter, int width) static Stringwrap(TextWidthCounter textWidthCounter, String s, int width, int initialOffset, String initialIndent, String subsequentIndent)
-
Field Details
-
LOCALE_ROOT
Language neutral locale. -
LINESEP
-
-
Constructor Details
-
TextHelper
private TextHelper()
-
-
Method Details
-
concat
-
concat
-
concat
-
concat
-
wrap
public static String wrap(TextWidthCounter textWidthCounter, String s, int width, int initialOffset, String initialIndent, String subsequentIndent) -
adjustSpace
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 adjustwidth- maximum line widthcurWidth- current line width- Returns:
- adjusted sb
-
printHelp
public static void printHelp(PrintWriter writer, String title, String help, TextWidthCounter textWidthCounter, int width) -
nonNull
-
findPrefix
From src, find string whose prefix is prefix and store them in List and return it.- Parameters:
src- collection contains strings to inspectprefix- prefix- Returns:
- List of strings matched
-