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.
| Modifier and Type | Field and Description | 
|---|---|
| static String | LINESEP | 
| static Locale | LOCALE_ROOTLanguage neutral locale. | 
| Modifier and Type | Method and Description | 
|---|---|
| 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". | 
| static <T> String | concat(Collection<T> a,
      int offset,
      String sep) | 
| static <T> String | concat(Collection<T> a,
      int offset,
      String sep,
      String start,
      String end) | 
| static <T> String | concat(T[] a,
      int offset,
      String sep) | 
| static <T> String | concat(T[] a,
      int offset,
      String sep,
      String start,
      String end) | 
| 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. | 
| static String | nonNull(String str) | 
| static void | printHelp(PrintWriter writer,
         String title,
         String help,
         TextWidthCounter textWidthCounter,
         int width) | 
| static String | wrap(TextWidthCounter textWidthCounter,
    String s,
    int width,
    int initialOffset,
    String initialIndent,
    String subsequentIndent) | 
public static final Locale LOCALE_ROOT
public static final String LINESEP
public static <T> String concat(Collection<T> a, int offset, String sep, String start, String end)
public static <T> String concat(Collection<T> a, int offset, String sep)
public static String wrap(TextWidthCounter textWidthCounter, String s, int width, int initialOffset, String initialIndent, String subsequentIndent)
public static StringBuilder adjustSpace(StringBuilder sb, int width, int curWidth)
sb - String to adjustwidth - maximum line widthcurWidth - current line widthpublic static void printHelp(PrintWriter writer, String title, String help, TextWidthCounter textWidthCounter, int width)
public static List<String> findPrefix(Collection<String> src, String prefix)
src - collection contains strings to inspectprefix - prefixCopyright © 2012–2017. All rights reserved.