List of utility methods to do Word Wrap
String | wordWrap(String input, int width, Locale locale) Reformats a string where lines that are longer than width are split apart at the earliest wordbreak or at maxLength, whichever is sooner. if (input == null) { return ""; } else if (width < 5) { return input; } else if (width >= input.length()) { return input; StringBuffer buf = new StringBuffer(input); ... |
String | wordWrap(String input, int width, Locale locale) Reformats a string where lines that are longer than width are split apart at the earliest wordbreak or at maxLength, whichever is sooner. if (input == null) { return ""; } else if (width < 5) { return input; } else if (width >= input.length()) { return input; if (locale == null) { ... |
String | wordWrap(String input, int width, Locale locale) word Wrap if (input == null) { return ""; } else if (width < 5) { return input; } else if (width >= input.length()) { return input; StringBuilder buf = new StringBuilder(input); ... |
String | wrapString(String original, int width, BreakIterator breakIterator, boolean removeNewLines) Wrap multi-line strings. String[] sarray = wrapStringToArray(original, width, breakIterator, removeNewLines); StringBuffer retBuf = new StringBuffer(); for (int i = 0; i < sarray.length; i++) { retBuf.append(sarray[i]); retBuf.append('\n'); return retBuf.toString(); |
String[] | wrapStringToArray(String original, int width, BreakIterator breakIterator, boolean removeNewLines) Wrap multi-line strings (and get the individual lines). if (original.length() == 0) { return new String[] { original }; String[] workingSet; if (removeNewLines) { original = trimString(original); original = original.replace('\n', ' '); workingSet = new String[] { original }; ... |
String | wrapText(String s, int width, boolean noIterator) wrap Text if (noIterator) { if (s == null || s.length() <= width) { return s; String ret = ""; int start = 0; int end = width; int len = s.length(); ... |
String | wrapText(String string, int theWrapLength) wrap Text return wrapText(string, "\n", theWrapLength); |