# coyote: TEXTLINEFORMAT

- coyote/Utilities
- [Source code]

NAME

      TextLineFormat

PURPOSE

      This is a utility program for taking a line of text and shortening
      it to a defined maximum length. The result of the function is a string
      array in which no line of text in the string array is longer than the maximum
      length. The text is broken into "words" by white space. The algorithm is
      modified slightly if there are LF (line feeds) in the text, or if any single
      word in the text is too large to fit on a line.

AUTHOR

      FANNING SOFTWARE CONSULTING
      David Fanning, Ph.D.
      1645 Sheely Drive
      Fort Collins, CO 80526 USA
      Phone: 970-221-0438
      E-mail: david@idlcoyote.com
      Coyote's Guide to IDL Programming: http://www.idlcoyote.com

CATEGORY

      Utilities

CALLING SEQUENCE

      formattedText = TextLineFormat(theText)

INPUTS

      theText:   The line of text that is to be formatted.

KEYWORDS

      LENGTH:    The maximum line length allowed in the resulting text array.
                 Set to 60 characters by default. Lines greater than length
                 can be permitted if Line Feeds (ASCII 10B) are found
                 in the text or single words are too large to fit on a line.

MODIFICATION HISTORY

      Written by David Fanning, June 2005.
      Fixed a small problem with cumulative total not counting spaces between
         words. Changed the default size to 60. DWF. 18 August 2005.
      Added check for LF in text to accommodate reading netCDF file attributes.
          If LF are present, I break on these, and return. 15 Feb 2008. DWF.
      Better handling of lines with no white space in them for breaking. 23 March 2009. DWF.