For short lists of strings, instr performs well.
function Lookup(string list,k) as sys
=====================================
sys p,v
lk=len k
do
  p=instr(p+1,list,k)
  if p=0 then exit do
  if p
    if asc(list,p-1)<33 and asc(list,p+lk)=44
      v=asc(list,p+lk+1)-48
      exit do
    end if
  end if
end do
return v
end function
list="
left,1
right,2
top,3
bottom,4
above,5
below,6
"
k="top"
print k "   " Lookup(list,k)
Charles