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


Syntax:     SPACE(<expN>)

Purpose:    To return a string of spaces.

Arguments:  <expN> is the number of spaces to return up to a maximum
            of 65,535 (64K).

Returns:    A character string.  SPACE(0) returns a null string ("").

Usage:      SPACE() is a general purpose character function and so can
            be used for a number of different purposes including:

            Initializing memory variables for data input.

            m_cust = SPACE(LEN(Customer))
            @ 10,10 SAY "Customer Name" GET m_cust
            READ

            Formatting strings.  The following example right-justifies a
            string within a column definition.

            number      = "12345"
            col_width   = 12
            ? SPACE(col_width - LEN(LTRIM(number))) +;
               LTRIM(number)

            To create a function that places the cursor
            nondestructively.

            PROCEDURE CursorAt
            PARAMETERS row, col
            @ row, col SAY SPACE(0)
            RETURN

Library:    CLIPPER.LIB


----------------------------------- Examples -------------------------------

   ? LEN(SPACE(20))                    && Result: 20
   ? SPACE(5) + "Indented 5 spaces"

   Result:

      String indented 5 spaces


See Also: REPLICATE()

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