LIKE( ) Function
Determines if a character expression matches another character expression.
LIKE(cExpression1, cExpression2)
Parameters
cExpression1
Specifies the character expression that LIKE( ) compares with cExpression2. cExpression1 can contain the wildcards such as * and ?. The question mark (?) matches any single character in cExpression2 and the asterisk (*) matches any number of characters. You can mix any number of wildcards in any combination in cExpression1.cExpression2
Specifies the character expression LIKE( ) compares with cExpression1. cExpression2 must match cExpression1 letter for letter in order for LIKE( ) to return true (.T.).
Return Value
Logical
Remarks
LIKE( ) returns true (.T.) if cExpression1 matches cExpression2; otherwise, it returns false (.F.).
SET COMPATIBLE determines how LIKE( ) evaluates cExpression1 and cExpression2. If SET COMPATIBLE is set to ON or DB4, cExpression1 and cExpression2 have all trailing blanks removed before they are compared. If SET COMPATIBLE is set to OFF or FOXPLUS, any trailing blanks in cExpression1 and cExpression2 are used in the comparison.
Example
In the following example, all product names in the products table with the first two letters "Ch" are displayed.
CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')
USE products && Open Products table
CLEAR
? 'All product names with first two letters Ch:'
?
SCAN FOR LIKE('Ch*', prod_name)
? prod_name
ENDSCAN
USE