Click or drag to resize

Difference Function

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

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.21
Syntax
 FUNCTION Difference(
	cExpression1,
	cExpression2
) AS USUAL CLIPPER
Request Example View Source

Parameters

cExpression1 (Optional)
Type: Usual
Specifies the character expressions that DIFFERENCE( ) compares.
cExpression2 (Optional)
Type: Usual
Specifies the character expressions that DIFFERENCE( ) compares.

Return Value

Type: Usual
Numeric
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.
Examples
X#
1STORE 'Smith' TO gcName1
2STORE 'Smythe'  TO gcName2
3STORE 'Smittie' TO gcName3
4STORE '' TO gcName4
5Clear
6? Difference(gcName1, gcName2)  // Displays 4
7? Difference(gcName1, gcName3)  // Displays 4
8? Difference(gcName1, gcName4)  // Displays 1
See Also