web analytics

JavaScript: Soundex implementation

There is a special algorithm for comparision strings, which sound similar (Soundex).

Here is JavaScript Soundex implementation:

function soundex ( s_src ) {      var s_rez = "0000" ;  var new_code, prev, idx    a_codes = { "bfpv": 1, "cgjkqsxz":2, "dt": 3, "l": 4, "mn": 5, "r": 6 };    s_src = s_src.toLowerCase().replace(/ /g,"") […]