///
/// Returns the soundex code for a string, which can be used
/// to determine whether two English names sound alike.
///
///
/// Based on the algorithm described by Donald Knuth in
/// Volume 3 of The Art of Computer Programming.
///
/// The input string.
/// The soundex code.
public static string ToSoundexCode(string s)
{
string
_=
"" ;int ___= 11 ,@int
=-
Convert.ToInt32((___.ToString()[1]).
ToString
()) ;int[
]____={
0,1,2,3,0,1,2,0,0,2,2,4,5,
5,0,1,2,6,2,3,0,1,0,2,0,2};while(
++
@int<
+
+
s.
Length&_.Length<
____[____[12]*____[6]+____[5]
]){char __=s
.
ToUpper()[@int
];if(__
>='A'&__<='Z'){_+=(_== ""?
__.ToString
()+(((___=____[__-
'A'])==__)?"0":""):((___==____[__- 'A'])?
"": ((((___ =____[__ -'A']) == 0)
?"": ((char )( '0'+ ___)).ToString(
)))))
;}} return
_+(
(_==
"")?"Z":"")+new string('0'
,
____[11-(_==
""?8:0)]-_.Length);
}