VSFlexString Control > VSFlexString Properties, Events, and Methods > VSFlexString Properties > Soundex Property |
Returns a phonetic code representing the current Text string.
val$ = [form!]VSFlexString.Soundex
This property allows you to search a database for strings even if you don't know the exact spelling. The database must include a Soundex field that encodes another field such as last name. When doing the search, look for the Soundex code instead of looking for the name.
The Soundex code consists of an uppercase letter followed by up to three digits. It is built by assigning codes to each character of the input string, then discarding vowels and repeated codes. The table below shows a few strings and their Soundex codes:
Andersen, Anderson, Anders: A536
Agassis, Agassi, Agaci: A2
Nixon, Nickson: N25
Johnson, Jonson: J525
Johnston: J523
Rumpelstiltskin, Runpilztiskin, Rumpel: R514
The advantages of this system are that the code is short, it will rarely miss a match, and the system is widely known and already implemented in many databases (the Soundex method was developed in 1918 by M.K. Odell and R.C. Russel). The disadvantage is that it will often find spurious matches that are only vaguely similar to the search string.
String