Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Clipper Tools One Guide - <b>center()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
CENTER()

Syntax:     CENTER(<expC1>[,<expN>][,<expC2>][,<expL>])

Arguments:  <expC1> is the string to be processed.
            <expN> denotes  the line.
            <expC2> contains the character to pad <expC1>.
            <expL> denote whether to pad only the start or both sides
            of <expC1>.

Returns:    A character string.
            The processed <expC1> string.

Usage:      The CENTER() function allows text to be centered in a simple
            manner, with any line length.  CENTER() allows any single
            character to be used to pad either the start or both sides of
            the string.  If a pad character is specified, then the string will
            first be trimmed left and right before processing.  If <expN>
            is not specified, CENTER() will assume the line width to be
            MAXCOL() + 1, so correct output will also be produced in
            windows.  The existing cursor position, or the column position
            selected via a SAY command, will also be considered if this
            argument is missing.  If it is required to produce an output
            from column 20 in an 80 character line, then a selection of 40
            40 characters from position 20 will be used for centering.
            See examples.

Notes:      One character will be added at the beginning of the
            string when the sum of the filled characters determined is
            odd.

Library:    CT1.LIB


--------------------------------- Example ------------------------------

Examples:   * Center with a line length of 10
            *
            * Insert leading spaces.
            ? CENTER("xx",10)                   && "        xx"

            * Fill in on the left and right
            ? CENTER("xx",10,.T.)               && "        xx        "

            * Characters of the <expC2> type already
            * present are removed.
            ? CENTER("xx        ",10,.T.)       && "        xx        "

            * Fill in with another character
            ? CENTER("xx",10,".")               && "....xx"
            ? CENTER("xx",10,".",.T.)           && "....xx...."
            ? CENTER("x",10,".",.T.)            && ".....x...."

            * The "Xs" in the example below are intended
            * to represent a screen 40 characters wide.
            * The Clipper string will then appear as an
            * output from position 10 with the "." character
            * centered.

            -@ 1,10 SAY CENTER("CLIPPER",".",.T.)



See Also: PADLEFT() PADRIGHT()

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