org.plasma.common
Class WordWrap

java.lang.Object
  extended by org.plasma.common.WordWrap

public class WordWrap
extends Object


Method Summary
static 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

wordWrap

public static 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 the width specified is less than 5 or greater than the input Strings length the string will be returned as is.

Please note that this method can be lossy - trailing spaces on wrapped lines may be trimmed.

Parameters:
input - the String to reformat.
width - the maximum length of any one line.
Returns:
a new String with reformatted as needed.


Copyright © 2013. All rights reserved.