home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
database
/
dbadvan.zip
/
SOUNDEX.PRG
< prev
next >
Wrap
Text File
|
1987-02-14
|
2KB
|
60 lines
** start newstring with the first letter of the string
&firstchar
&startstr
* remember this character
STORE &character TO lastchar
&nextchar
*process the string until don or four characters are in newstring
DO WHILE .not. &endstring .AND. len(newstring) < 4
DO CASE
* drop all duplicate letters
cas &character = lastchar
* drop all occurrences of a,e,h,i,o,u,w,y
CASE &character $ "AEHIOUWY"
*convert b,f,p,v, to 1
CASE &character $ "BFPV"
STORE newstring + "1" TO newstring
*convert c,g,j,k,q,s,x,z to 2
CASE &character $ "CGJKQSXZ"
STORE newstring + "2" TO newstring
*convert d,t to 3
CASE &character $ "DT"
STORE newstring + "3" TO newstring
*convert 1 to 4
CASE &character $ "MN"
STORE newstring + "5" TO newstring
* CONVERT M,N TO 5
case &character $ "MN"
store newstring + "5" to newstring
*convert r to 6
CASE &character $ "R"
STORE newstring + "6" TO newstring
ENDCASE
***remember this character and move to the next one
STORE &character TO lastchar
&nextchar
ENDDO WHILE .not. &endstring .AND. len(newstrin
*if newstring is less than 4 characters, add trailing zeros
DO WHILE len(newstring) < 4
STORE newstring + "0" TO newstring
ENDDO WHILE len(newstring) < 4
**cleanup
RELEASE lastchar
****************************************************************
****************************************************************
****************************************************************
****************************************************************
****************************************************************