# File lib/facet/soundex.rb, line 67 def soundex_str(str) return nil if str.empty? str = str.upcase last_code = get_code(str[0,1]) soundex_code = str[0,1] for index in 1...(str.size) do return soundex_code if soundex_code.size == 4 code = get_code(str[index,1]) if code == "0" then last_code = nil elsif code == nil then return nil elsif code != last_code then soundex_code += code last_code = code end end # for return soundex_code + "000"[0,4-soundex_code.size] end