global val$ val$(1) = "BPFV" val$(2) = "CSGJKQXZ" val$(3) = "DT" val$(4) = "L" val$(5) = "MN" val$(6) = "R" ' --------------------------------- ' show soundex on these words ' --------------------------------- w$(1) = "Robert" 'R163 w$(2) = "Rupert" 'R163 w$(3) = "Rubin" 'R150 w$(4) = "moses" 'M220 w$(5) = "O'Mally" 'O540 w$(6) = "d jay" 'D200 for i = 1 to 6 print w$(i);" soundex:";soundex$(w$(i)) next i wait ' --------------------------------- ' Return soundex of word ' --------------------------------- function soundex$(a$) a$ = upper$(a$) for i = 2 to len(a$) theLtr$ = mid$(a$,i,1) s$ = "0" if instr("AEIOUYHW |",theLtr$) <> 0 then s$ = "" if theLtr$ <> preLtr$ then for j = 1 to 6 if instr(val$(j),theLtr$) <> 0 then s$ = str$(j) next j end if sdx$ = sdx$ + s$ preLtr$ = theLtr$ next i soundex$ = left$(a$,1) + left$(sdx$;"000",3) end function