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> getparm() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function:    GETPARM()

Purpose:     Retrieve a comma delimited token from a character string

Syntax:      GETPARM( position, string )

Arguments:   position    - Numeric value indicating the ordinal position
                           in the comma delimited token list.

             string      - The comma delimited string from which to
                           extract the token following the <position>-1
                           comma.

Returns:     The extracted portion of <string> starting at the
             (<position>-1)th comma up to the next comma or the end of the
             string.   If no characters exist at the ordinal position
             indicated, or if any arguments are missing or an invalid
             type, GETPARM() will return a null string.

Description: This function is used to retrieve a comma delimited parameter
             from a character string.  The ways in which this can be used
             are unlimited, but as an example, several RLIB functions use
             GETPARM() to retrieve color settings from SETCOLOR().

Notes:       GETPARM() is used in many RLIB functions to parse SETCOLOR()
             to retrieve default colors when no color arrays are specified
             in functions that offer color as an option.  Therefore, you
             must not remove GETPARM() from RLIB!

Example:     *-- get the current Enhanced color setting from the
             *-- second part of SETCOLOR()
             mreverse = GETPARM(2, SETCOLOR())

             *-- this will return "W/R" if SETCOLOR()="R/W,W/R,,,R/BG"
             *-- 2nd token parameter is -------------------^


             Example #2:

             *-- write a function that accepts several parameters, all
             *-- contained in one character string.

             *-- Here is a sample parameter
             files = "TEST1.DBF, TEST2.DBF, TEST3.DBF, TEST4.DBF"


             *-- here is the call to the function
             *-- open all the files in the string in separate work areas
             OPENFILES(files)


             *----------------------------------------------------------
             *-- now here's your UDF to open many files in one swoop
             *----------------------------------------------------------
             FUNCTION OpenFiles
             PARAMETER filenames
             PRIVATE file2open, x
             x = 1
             DO WHILE .T.
                file2open = GETPARM(x, filenames)
                IF EMPTY(file2open)
                   EXIT
                ENDIF
                SELECT 0
                USE (file2open)
                x = x + 1
             ENDDO
             RETURN .T.

Source:      RL_GETPA.PRG

See also:    BRIGHT()

See Also: BRIGHT()

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