home *** CD-ROM | disk | FTP | other *** search
- Start:
- Input "Enter First String: ",Fs$
- Input "Enter Second String: ",Ss$
- Call Soundex(Fs$,Code1$)
- Call Soundex(Ss$,Code2$)
- print "Soundex for First :",Code1$
- print "Soundex for Second:",Code2$
- goto Start
-
- sub Soundex(St$,Code$) static
- Lettr$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ'-, "
- Numbr$ = "012301200224550126230102020000"
- for Up%=1 to len(St$)
- if asc(mid$(St$,Up%,1)) > 96 then
- mid$(St$,Up%,1) = chr$(asc(mid$(St$,Up%,1)) - 32)
- end if
- next Up%
-
- Code$ = mid$(St$,1,1)
- Posy% = 2
- Cnt% = 2
- Prior$ = "0"
- Length% = len(St$)
- if Code$ = mid$(St$,2,1) then
- Posy% = 3
- end if
- while Posy% <= Length%
- Cnum$ = mid$(Numbr$,instr(Lettr$,mid$(St$,Posy%,1)),1)
- if Cnum$ <> "0" then
- if Cnum$ <> Prior$ then
- if Cnt% <= 4 then
- Code$ = Code$ + Cnum$
- Prior$ = Cnum$
- Cnt% = Cnt% + 1
- end if
- end if
- else
- Prior$ = "0"
- end if
- Posy% = Posy% + 1
- wend
-
- 'while len(Code$) < 4
- ' Code$ = Code$ + "0"
- 'wend
- end sub
-