home *** CD-ROM | disk | FTP | other *** search
- on NameToNum name
- set num to Bsearch(name, "MakerList")
- return value(item 2 of line num of field "MakerList")
- end
-
- on Bsearch str, txt
- set txt to the number of cast txt
- set start to 1
- set end to the number of lines in field txt
- set middle to (start + end) / 2
- repeat while str <> item 1 of line middle of field txt
- if str = item 1 of line end of field txt then
- return end
- end if
- if start = middle then
- return 0
- end if
- if str < item 1 of line middle of field txt then
- set end to middle
- else
- set start to middle
- end if
- set middle to (start + end) / 2
- end repeat
- if str = item 1 of line middle of field txt then
- return middle
- else
- return 0
- end if
- end
-