Using Dollar Sign ($) Function in FoxBASE+ or FoxPro

ID: Q88891

The information in this article applies to:

The dollar sign ($) function searches for a string contained in another string. The correct syntax of the command is as follows:

   LOCATE FOR 'BOB'$UPPER(NAME)

This example locates a record that contains the string "BOB" anywhere in the NAME field.

The $ function can operate on a character field, a string memory variable, or a memo field. If the character expression is found, the function returns true (.T.). If the character expression is not found, the function returns false (.F.).

NOTE: This function does not work in a Memo field in Foxbase+ for the Macintosh.

Here's another example showing how to use the $ function:

   ?'OKAY'$memvar

This example returns the value true if "memvar" contains the string "OKAY" and false if "memvar" does not contain the string.

NOTE: The $ function cannot be optimized with Rushmore in FoxPro versions 2.0 and later. To search for a character expression in an indexed field, issue the SET EXACT OFF command. Use the SEEK function for optimum speed.

Additional reference words: FoxWin FoxDos 2.50 2.50a 1.21 2.10 1.00 1.01 1.02 2.00 1.21 2.10 1.x 2.x KBCategory: kbprg KBSubcategory: FxprgGeneral

Last Reviewed: July 5, 1995