Click or drag to resize

SoundEx Function

Convert a string to Soundex form.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.2a
Syntax
 FUNCTION SoundEx(
	cString AS STRING
) AS STRING
View Source

Parameters

cString
Type: String
The string to convert.

Return Value

Type: String
A 4-digit string starting with an alphabetic character and ending with three digits.
Remarks
Soundex() is a character function that indexes and searches for sound-alike or phonetic matches.  It is used in applications where the precise spelling of character keys is not known or where there is a high probability of misspelled names.  Misspelling is common in real-time transaction systems where the data entry operator is receiving information over the telephone.  Soundex() works by bringing sound-alikes together under the same key value.  Note, however, the soundex method is not absolute.  Keys that are quite different can result in the same soundex value.
Examples
This example builds an order using Soundex() to create the key values.  It then searches for a value found in the Salesman field:
X#
USE sales
INDEX ON Soundex(Salesman) TO salesman
SEEK Soundex("Smith")
? Found(), salesman                                // TRUE Smith
Here, a search is made for the same key as above but with a different spelling:
X#
SEEK Soundex("Smythe")
? Found(), salesman                                // TRUE Smith
See Also