A little late probably but here goes:
function asctoval(t$)
i = asc(t$) - 48
if i >= 0 and i <= 9 then retval = i else retval = -1
endfunction retval
This checks for zero through nine and will only get the first character so if you have "abc" or some invalid string, you will get a -1. Now, if you have "123" or even "4bc32" it will only get the first character, the "1" in the first string or "4" in the second and convert those to 1 and 4.
I hope this helps you.
-- I straddle the line between genius and insanity. Guess which side I am on now? --