VAL Function Action Returns the numeric value of a string of digits. Syntax VAL( stringexpression$) Remarks The argument stringexpression$ is a sequence of characters that can be interpreted as a numeric value. The VAL function stops reading the string at the first character that it cannot recognize as part of a number. The VAL function also strips blanks, tabs, and line feeds from the argument string. For example, the code below returns the value 1615198. VAL(" 1615 198th Street") See Also STR$ Example The following example prints the names and addresses of people with specific telephone area codes. ' This part of the program builds a sample data file. OPEN "PHONE.DAT" FOR OUTPUT AS #1 CLS RESTORE READ FuName$, ACPhone$ I = 0 DO WHILE UCASE$(FuName$) <> "END" I = I + 1 WRITE #1, FuName$, ACPhone$ READ FuName$, ACPhone$ IF FuName$ = "END" THEN EXIT DO LOOP CLOSE #1 DATA "Bob Hartzell ","206-378-3223" DATA "Alice Provan ","213-884-9700" DATA "Alex Landow ","213-456-3111" DATA "Walt Riley ","503-248-0048" DATA "Georgette Gump ","213-222-2222" DATA "END",0,0,0,0,0 ' This part of the program demonstrates the VAL function. INPUT "Search for which area (206, 213, or 503). ", Targetarea OPEN "PHONE.DAT" FOR INPUT AS #1 DO WHILE NOT EOF(1) INPUT #1, Nm$, Phonenum$ 'VAL reads everything up to the first non-numeric 'character ("-" in this case). Area = VAL(Phonenum$) IF Area = Targetarea THEN PRINT PRINT Nm$; PRINT Phonenum$ END IF LOOP CLOSE KILL "PHONE.DAT" END