prog.utils
Class WordWrap

java.lang.Object
  |
  +--prog.utils.WordWrap
All Implemented Interfaces:
TextFormatter

public class WordWrap
extends java.lang.Object
implements TextFormatter

The format() method of this class converts a long String into a multi-line String whose pieces are less than or equal to the specified line length. Any newline characters are retained, and newline characters are inserted wherever a word wrap is appropriate.

Author:
John E. Darrow (c) 2000

Field Summary
 int[] breakCols
          A record of the column numbers at which format() broke the input String to new lines.
 
Constructor Summary
WordWrap()
           
 
Method Summary
 java.lang.String format(java.lang.String str, int linelength)
          Converts a long String into a multi-line String that fits within a specified column width.
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

breakCols

public int[] breakCols
A record of the column numbers at which format() broke the input String to new lines.
Constructor Detail

WordWrap

public WordWrap()
Method Detail

format

public java.lang.String format(java.lang.String str,
                               int linelength)
Converts a long String into a multi-line String that fits within a specified column width.
Specified by:
format in interface TextFormatter

main

public static void main(java.lang.String[] args)