I am writing a program to interface with a voice answer back computer
over the telephone line. The following is a FUNCTON to translate the
alphabet into the number characters recognized by the voice answer back
computer. Your translation requirements might vary.
'This function translates the letters A to Z to their representation
'on the telephone dial. For example, A is on the 2 key and is the first
'letter shown. Q and Z are not on the dial and are represented by
'01 and 03 respectively.
'Example Use:
'PRINT SymbolNum$("IBM")
'Expected Output: 432261
FUNCTION SymbolNum$(SymbolLet$)
FOR Position% = 1 TO LEN(SymbolLet$) 'pick each character in turn
ch$ = UCASE$(MID$(SymbolLet$, Position%, 1))
SELECT CASE ch$
CASE "Q" 'special case; not on dial
Accumulate$ = "01"
CASE "Z" 'special case; not on dial
Accumulate$ = "02"
CASE "A" TO "Y" '"Q" "Z" CASES already handled above
Indexer% = INSTR("ABCDEFGHIJKLMNOPRSTUVWXY", ch$)
FirstNum$ = MID$("222333444555666777888999", Indexer%, 1)
SecondNum$ = MID$("123123123123123123123123", Indexer%, 1)
Accumulate$ = Accumulate$ + FirstNum$ + SecondNum$
END SELECT
NEXT
SymbolNum$ = Accumulate$
END FUNCTION
* OLX 2.2 * As Confucius said, "I didn't say that!"
--- WILDMAIL!/WC v4.12
---------------
* Origin: Acorn I BBS * 1:2624/503 * Marlboro, NY * USR 28.8 (1:2624/503.0)
|