- java.lang.Object
-
- net.sourceforge.argparse4j.helper.TextHelper
-
public final class TextHelper extends java.lang.ObjectThis class provides various helper function related to text processing.
The application code should not use this class directly.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringLINESEPstatic java.util.LocaleLOCALE_ROOTLanguage neutral locale.
-
Constructor Summary
Constructors Modifier Constructor Description privateTextHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringBuilderadjustSpace(java.lang.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> java.lang.Stringconcat(java.util.Collection<T> a, int offset, java.lang.String sep)static <T> java.lang.Stringconcat(java.util.Collection<T> a, int offset, java.lang.String sep, java.lang.String start, java.lang.String end)static <T> java.lang.Stringconcat(T[] a, int offset, java.lang.String sep)static <T> java.lang.Stringconcat(T[] a, int offset, java.lang.String sep, java.lang.String start, java.lang.String end)static java.util.List<java.lang.String>findPrefix(java.util.Collection<java.lang.String> src, java.lang.String prefix)From src, find string whose prefix is prefix and store them in List and return it.static java.lang.StringnonNull(java.lang.String str)static voidprintHelp(java.io.PrintWriter writer, java.lang.String title, java.lang.String help, TextWidthCounter textWidthCounter, int width)static java.lang.Stringwrap(TextWidthCounter textWidthCounter, java.lang.String s, int width, int initialOffset, java.lang.String initialIndent, java.lang.String subsequentIndent)
-
-
-
Method Detail
-
concat
public static <T> java.lang.String concat(T[] a, int offset, java.lang.String sep, java.lang.String start, java.lang.String end)
-
concat
public static <T> java.lang.String concat(T[] a, int offset, java.lang.String sep)
-
concat
public static <T> java.lang.String concat(java.util.Collection<T> a, int offset, java.lang.String sep, java.lang.String start, java.lang.String end)
-
concat
public static <T> java.lang.String concat(java.util.Collection<T> a, int offset, java.lang.String sep)
-
wrap
public static java.lang.String wrap(TextWidthCounter textWidthCounter, java.lang.String s, int width, int initialOffset, java.lang.String initialIndent, java.lang.String subsequentIndent)
-
adjustSpace
public static java.lang.StringBuilder adjustSpace(java.lang.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 adjustwidth- maximum line widthcurWidth- current line width- Returns:
- adjusted sb
-
printHelp
public static void printHelp(java.io.PrintWriter writer, java.lang.String title, java.lang.String help, TextWidthCounter textWidthCounter, int width)
-
nonNull
public static java.lang.String nonNull(java.lang.String str)
-
findPrefix
public static java.util.List<java.lang.String> findPrefix(java.util.Collection<java.lang.String> src, java.lang.String prefix)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
-
-