Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- RLIB 3.0a Reference - <b>function:</b> stretch() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function:    STRETCH()

Purpose:     Pad a string with blanks or truncate to a defined width.

Syntax:      STRETCH( string, length )

Arguments:   string      - Character string to pad with spaces (or to
                           truncate) to make length <length>.

             length      - Numeric desired length of the resulting string.

Returns:     <string> padded with spaces or truncated to <length>.

Description: STRETCH() is a character function used to normalized strings
             to a certain length.  This is most often used to guarantee
             that a character string will be a certain length, either by
             added spaces onto the end of the string, or by truncating
             characters off of the string.

Notes:       STRETCH() is also very useful is reports to aid in lining up
             columns.  If a variable may be an undetermined length, or if
             you fear a field may be lengthened or shortened, STRETCH()
             can be used to guarantee a defined output width.

             STRETCH() performs the same function as many PAD() functions
             but lacks other options which make it leaner.  STRETCH() may
             be customized to fit your particular needs.

             If a <length> of zero is specified, or if invalid arguments
             are supplied, STRETCH() will return a null string ("").

Example:     *-- expand a variable for edit length
             help_path = STRETCH(help_path,60)
             @ 10,20 SAY "Enter path for help files:"
             @ 11,20 GET help_path PICTURE "@!S40"
             READ
             *-- now trim it back down
             help_path = TRIM(help_path)

Source:      RL_STRET.PRG

See also:    CENTER(), MIDDLE()

See Also: CENTER() MIDDLE()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson