DIFFERENCE( ) Function

Returns an integer, 0 through 4, which represents the relative phonetic difference between two character expressions.

DIFFERENCE(cExpression1, cExpression2)

Return Value

Numeric

Parameters

  • cExpression1, cExpression2
    Specifies the character expressions that DIFFERENCE( ) compares.

Remarks

DIFFERENCE( ) is useful for searching tables when the exact spelling of an entry isn't known.

The more alike the two expressions are spelled, the higher the number DIFFERENCE( ) returns. If the character expressions are spelled very similarly, DIFFERENCE( ) returns 4. For two character expressions with little in common phonetically, DIFFERENCE( ) returns 0.

Example

STORE 'Smith' TO gcName1
STORE 'Smythe'  TO gcName2
STORE 'Smittie' TO gcName3
STORE '' TO gcName4
CLEAR
? DIFFERENCE(gcName1, gcName2)  && Displays 4
? DIFFERENCE(gcName1, gcName3)  && Displays 4
? DIFFERENCE(gcName1, gcName4)  && Displays 1

See Also

Reference

SOUNDEX( ) Function

Other Resources

Functions

Language Reference (Visual FoxPro)