The SoundexSimilar function Indicates whether the two strings AText and AOther are similar, by returning the boolean value True are similar, and False if the two strings are not sufficiently similar.

SoundexSimilar uses a Soundex algorithm to convert both strings into a phonetic representation where each character of the resulting string represents one of six families of similar phonemes. It then compares up to ALength digits in the resulting representation, returning True if they are all the same and False if they are not.

The parameter ALength is the number of characters to use when generating the Soundex string, where the range accepted is from 1 through to 8 due to the capacity of the integer type TSoundexIntLength. The higher the value, the more precision.

The SoundexProc function performs a similar comparison, but has a pre-determined default length check of four(4) characters. Please refer to SoundexProc for more information.

Declaration: Function SoundexSimilar(const AText, AOther: string; ALength: TSoundexLength): Boolean;

The following examples show matches and mismatches.

procedure ScriptEvent (var Value : variant);
var sConfYN : boolean;
begin
LogInfo('');
sConfYN := SoundexSimilar('Merryweather', 'Marywether',8);
LogInfo('Merryweather + Marywether');
If sConfYN = true then
LogInfo('The strings are silimar.')
else
LogInfo('The strings are NOT similar.');
 
sConfYN := SoundexSimilar('Owen', 'Eoin',8);
LogInfo('Owen + Eoin');
If sConfYN = true then
LogInfo('The strings are silimar.')
else
LogInfo('The strings are NOT similar.');
 
sConfYN := SoundexSimilar('Perez', 'Pierce',8);
LogInfo('Perez + Pierce');
If sConfYN = true then
LogInfo('The strings are silimar.')
else
LogInfo('The strings are NOT similar.');
 
sConfYN := SoundexSimilar('Tomson', 'Thomson',8);
LogInfo('Tomson + Thomson');
If sConfYN = true then
LogInfo('The strings are silimar.')
else
LogInfo('The strings are NOT similar.');
 
sConfYN := SoundexSimilar('Leigh', 'Lee',8);
LogInfo('Leigh + Lee');
If sConfYN = true then
LogInfo('The strings are silimar.')
else
LogInfo('The strings are NOT similar.');
 
sConfYN := SoundexSimilar('ruby', 'roobie',8);
LogInfo('ruby + roobie');
If sConfYN = true then
LogInfo('The strings are silimar.')
else
LogInfo('The strings are NOT similar.');
end;