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

Purpose:     Convert names from First Middle Last to Last, First Middle.

Syntax:      NAMESPLIT( name )

Arguments:   name        - Character string indicating the name string in
                           the form First Middle Last to parse into Last,
                           First Middle.

Returns:     A character string equal to <name> flipped to lastname first,
             with a comma space inserted.

Description: NAMESPLIT() is a character function used to parse names to
             split into the last name, middle name, and first name
             components.  What NAMESPLIT() does is let you type in a name
             in the form RICHARD C.  LOW, and it returns LOW, RICHARD C.
             This is particularly useful for SEEKing names from an index
             that was indexed on PAD(TRIM(Lastname)+', '+Firstname,32).
             Such an index will insure the correct ordering of names.
             This is especially helpful in front end applications as a
             user interface tool...NAMESPLIT() can allow a user to perform
             a name search without regard to internal name storage format.

Notes:       NAMESPLIT() is aware of the standard name suffixes, i.e.
             JR., SR., II, 2ND, III, 3RD, 4TH, M.D., PHD, and will
             recognize these as not being lastnames.  Without this, a name
             entered as RICHARD C.  LOW, JR.  may incorrectly be split
             into JR., RICHARD C.  However, there will be occasions where
             a name/ suffix combination may not work.  The good news is
             that NAMESPLIT() makes name entering easier 99% of the time.

Example:     ? NAMESPLIT("John Smith")
                *-- returns "Smith, John"

             ? NAMESPLIT("John M.  Smith, MD")
                *-- returns "Smith MD, John M."


             *-- consider a file indexed on the following key:
             *-- (note that the above index expression is built to, then
             *-- limited to 32 characters in order to keep the index key
             *-- a constant length)
             INDEX ON UPPER(PAD(TRIM(Lastname)+", "+Firstname,32)) TO x

             ? "Enter name to locate:"
             mname = KEYINPUT(40,.T.)         && they enter "RICHARD LOW"
             SEEK NAMESPLIT(mname)            && it finds "LOW, RICHARD"

Source:      RL_NAMES.PRG

See also:    GETPARM(), KEYINPUT()

See Also: GETPARM() KEYINPUT()

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