View source code
Display the source code in std/string.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Function std.string.soundexer
Soundex algorithm.
The Soundex algorithm converts a word into 4 characters based on how the word sounds phonetically. The idea is that two spellings that sound alike will have the same Soundex value, which means that Soundex can be used for fuzzy matching of names.
Prototype
char[4] soundexer(Range)( Range str ) if (isInputRange!Range && isSomeChar!(ElementEncodingType!Range));
Parameters
Name | Description |
---|---|
str | String or InputRange to convert to Soundex representation . |
Returns
The four character array with the Soundex result in it.
The array has zero's in it if there is no Soundex representation
for the string.
See Also
Bugs
Only works well with English names. There are other arguably better Soundex algorithms, but this one is the standard one.
Authors
Walter Bright, Andrei Alexandrescu, and Jonathan M Davis