---
url: >-
  /statelake/scripting-reference/functions-and-procedures/string-functions/soundex-functions/soundexword.md
---

# SoundexWord

**SoundexWord** is a function that creates a **Word** type integer that represents the phonetic value of the source string **AText**, using a **Soundex** algorithm.

The source string **AText** is converted into a phonetic string representation where each resulting character represents one of six families of similar phonemes. It then returns an unsigned 16-bit value that uniquely represents the first four (4) **Soundex** codes in that string representation.

The case of the source string is irrelevant.

**Declaration**: Function SoundexWord( const AText : string) : Word;

Examples are as below.

```pascal
procedure ScriptEvent (var Value : variant);
var
  sInput : string;
  wSound : word;
begin
  LogInfo('');
  sInput := 'MCGILLICUDDY';                           //All uppercase
  wSound := SoundexWord(sInput);
  LogInfo(sInput+' equals '+IntToStr(wSound));

  sInput := 'mcgillicuddy';                           //All lowercase
  wSound := SoundexWord(sInput);
  LogInfo(sInput+'(w) equals '+IntToStr(wSound));

  sInput := 'Pumpkin';                                //Sentence case
  wSound := SoundexWord(sInput);
  LogInfo(sInput+'(w) equals '+IntToStr(wSound));

  sInput := 'Romano-Wickham';                         //Hyphenated
  wSound := SoundexWord(sInput);
  LogInfo(sInput+'(w) equals '+IntToStr(wSound));

  wSound := SoundexWord('Robinson Crusoe'');          //Name + surname
  LogInfo(sInput+'(w) equals '+IntToStr(wSound));
  LogInfo('');
end;
```
