Core Function Soundex

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "<pre> Soundex( <str> ) </pre> === Description === Calculate the soundex key of a string. === Parameters === ==== string ==== The input string. === Return Value === Return...")
 
m (1 revision)
 
(2 intermediate revisions by one user not shown)
Line 27: Line 27:
 
=== Example ===
 
=== Example ===
  
 +
<syntaxhighlight lang="sputnik">
 
say soundex("Euler"); // E460
 
say soundex("Euler"); // E460
 
say soundex("Gauss"); // G200
 
say soundex("Gauss"); // G200

Latest revision as of 12:37, 14 June 2015

Soundex( <str> )

Contents

Description

Calculate the soundex key of a string.

Parameters

string

The input string.

Return Value

Returns the soundex key as a string.

Remarks

Soundex keys have the property that words pronounced similarly produce the same soundex key, and can thus be used to simplify searches in databases where you know the pronunciation but not the spelling.

This soundex function returns a string 4 characters long, starting with a letter.

This particular soundex function is one described by Donald Knuth in "The Art Of Computer Programming, vol. 3: Sorting And Searching", Addison-Wesley (1973), pp. 391-392.

Example

say soundex("Euler"); // E460
say soundex("Gauss"); // G200
say soundex("Hilbert"); // H416
say soundex("Knuth"); // K530
say soundex("Lloyd"); // L300
say soundex("Lukasiewicz"); // L222
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox