@Test public void testWrapWithEmptyString() { List<String> result; result = TextUtil.wrap("", 10); assertEquals(0, result.size()); }
public static List<String> wrap(String in, int length, String prefix, String wrappedLineIndent) { if (prefix == null) { prefix = ""; } if (wrappedLineIndent == null) { wrappedLineIndent = ""; } List<String> result = wrap(in, length - prefix.length()); for (int i = 0; i < result.size(); i++) { if (i == 0) { result.set(i, prefix + result.get(i)); } else { result.set(i, prefix + wrappedLineIndent + result.get(i)); } } return result; }
TextUtil { public static List<String> wrap(String in, int length, String prefix, String wrappedLineIndent) { if (prefix == null) { prefix = ""; } if (wrappedLineIndent == null) { wrappedLineIndent = ""; } List<String> result = wrap(in, length - prefix.length()); for (int i = 0; i < result.size(); i++) { if (i == 0) { result.set(i, prefix + result.get(i)); } else { result.set(i, prefix + wrappedLineIndent + result.get(i)); } } return result; } }
TextUtil { public static List<String> wrap(String in, int length, String prefix, String wrappedLineIndent) { if (prefix == null) { prefix = ""; } if (wrappedLineIndent == null) { wrappedLineIndent = ""; } List<String> result = wrap(in, length - prefix.length()); for (int i = 0; i < result.size(); i++) { if (i == 0) { result.set(i, prefix + result.get(i)); } else { result.set(i, prefix + wrappedLineIndent + result.get(i)); } } return result; }  }
TextUtil { public static List<String> wrap(String in, int length, String prefix, String wrappedLineIndent) { if (prefix == null) { prefix = ""; } if (wrappedLineIndent == null) { wrappedLineIndent = ""; } List<String> result = wrap(in, length - prefix.length()); for (int i = 0; i < result.size(); i++) { if (i == 0) { result.set(i, prefix + result.get(i)); } else { result.set(i, prefix + wrappedLineIndent + result.get(i)); } } return result; }  static void println(PrintStream out, String pattern, Object... args); static void println(PrintStream out, int maxLineLength, String linePrefix, String pattern, Object... args); static void println(PrintStream out, int maxLineLength, String linePrefix, String content); static String format(String pattern, Object... args); static String repeat(String base, int repeat); static String padRight(String base, String repeatString, int totalLength); static String trimToNull(String source); static String nullToEmpty(String source); static String trimToEmpty(String source); static boolean toBoolean(String value); static List<String> wrap(String in, int length, String prefix, String wrappedLineIndent); static List<String> wrap(String in, int length); static int findFirstInstanceOf(String toBeSearched, int searchFrom, String... toBeFound); static int findLastInstanceOf(String toBeSearched, int searchFrom, String... toBeFound); static String escapeXml(String text); }
TextUtil { public static List<String> wrap(String in, int length, String prefix, String wrappedLineIndent) { if (prefix == null) { prefix = ""; } if (wrappedLineIndent == null) { wrappedLineIndent = ""; } List<String> result = wrap(in, length - prefix.length()); for (int i = 0; i < result.size(); i++) { if (i == 0) { result.set(i, prefix + result.get(i)); } else { result.set(i, prefix + wrappedLineIndent + result.get(i)); } } return result; }  static void println(PrintStream out, String pattern, Object... args); static void println(PrintStream out, int maxLineLength, String linePrefix, String pattern, Object... args); static void println(PrintStream out, int maxLineLength, String linePrefix, String content); static String format(String pattern, Object... args); static String repeat(String base, int repeat); static String padRight(String base, String repeatString, int totalLength); static String trimToNull(String source); static String nullToEmpty(String source); static String trimToEmpty(String source); static boolean toBoolean(String value); static List<String> wrap(String in, int length, String prefix, String wrappedLineIndent); static List<String> wrap(String in, int length); static int findFirstInstanceOf(String toBeSearched, int searchFrom, String... toBeFound); static int findLastInstanceOf(String toBeSearched, int searchFrom, String... toBeFound); static String escapeXml(String text); static final String[] EMPTY_STRING_ARRAY; static final List<String> EMPTY_STRING_LIST; static final String NULL_PRINT; static final String SECOND_LINE_INDENT; }