restore for c = 1 to 20 read nombre$ print "\"", nombre$, "\" \t", Soundex$(nombre$) next c data "Aschraft","Ashcroft","Euler","Gauss","Ghosh","Hilbert","Heilbronn","Lee","Lissajous","Lloyd" data "Moses","Pfister","Robert","Rupert","Rubin","Tymczak","VanDeusen","Wheaton","Soundex$","Example" print end sub getCode$ (c$) if instr("BFPV", c$) return "1" if instr("CGJKQSXZ", c$) return "2" if instr("DT", c$) return "3" if "L" = c$ return "4" if instr("MN", c$) return "5" if "R" = c$ return "6" if instr("HW", c$) return "." end sub sub Soundex$ (palabra$) palabra$ = upper$(palabra$) code$ = mid$(palabra$, 1, 1) previo$ = getCode$(left$(palabra$, 1)) for i = 2 to (len(palabra$)) actual$ = getCode$(mid$(palabra$, i, 1)) if actual$ <> "." then if len(actual$) > 0 and actual$ <> previo$ code$ = code$ + actual$ previo$ = actual$ if len(code$) = 4 break end if next i if len(code$) < 4 code$ = left$(code$ + "0000", 4) return left$(code$, 4) end sub