SOUNDEX(), SOUNDEXS() |
![]() ![]() ![]() |
The SOUNDEX() function returns a four character string determined by the phonetic content of a string. The SOUNDEXS() function is similar to SOUNDEX() but operates on successive elements of a dynamic array, returning a similarly structured dynamic array of results.
Format
SOUNDEX(string)
where
The SOUNDEX() function is useful for situations where it is desired to compare or locate items by their spoken sound. For example, names in a telephone directory could be indexed by their SOUNDEX() value to aid location of similar sounding names.
The value returned by SOUNDEX() is made up from the first letter of string in upper case followed by three digits which are found by examination of further characters of string according to the following table.
Letters in group 0 are ignored. Consecutive letters that result in the same value result in only a single character. If the result is less than four characters long, zeros are added to fill the remaining positions. Thus the word SOUNDEX encodes to S532.
Example
DISPLAY "Enter name " INPUT NAME KEY = SOUNDEX(NAME) READ OTHER.NAMES FROM PHONONYMS, KEY THEN NAME = OTHER.NAMES END
This program fragment prompts for and reads a name. It then establishes the soundex key for this name and attempts to read a list of similar sounding names from the PHONONYMS file. If found, this list replaces the NAME value. |