Soundex is a phonetic algorithm for indexing names by sound, as pronounced in English.
The goal is for homophones to be encoded to the same representation so that they can be matched despite minor differences in spelling.
The algorithm mainly encodes consonants; a vowel will not be encoded unless it is the first letter.

Soundex is the most widely known of all phonetic algorithms, as it is a standard feature of MS SQL and Oracle, and is often used (incorrectly) as a synonym for 'phonetic algorithm'

soundEx(str) → returns string

This function requires Lucee.  Not supported on Adobe ColdFusion, etc.

Argument Reference

str string

Sample code invoking the soundEx function

Both "Robert" and "Rupert" return the same string "R163" while "Rubin" yields "R150"


Expected Result: R163/R163/R150

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub