home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a012 / 1.ddi / CHAP19.EXE / CHP1908.PRG < prev    next >
Encoding:
Text File  |  1991-04-30  |  1.0 KB  |  44 lines

  1. /*
  2.    Listing 19.8  Keyword functions
  3.    NOTE: calls PARSE, which is contained in CHP22xx.PRG
  4.    Author: Joe Booth
  5.    Excerpted from "Clipper 5: A Developer's Guide"
  6.    Copyright (c) 1991 M&T Books
  7.                       501 Galveston Drive
  8.                       Redwood City, CA 94063-4728
  9.                       (415) 366-3600
  10. */
  11.  
  12. function keyw_build(cTitle,cId_code)
  13. LOCAL skip_words:={"A","THE","OF","AND"}
  14. LOCAL words:= Parse(upper(cTitle)," ")
  15. LOCAL jj
  16. use KEYWORD new index KEYW
  17. for jj = 1 to len(words)
  18.    if ascan(skip_words,words[jj]) = 0
  19.       append blank
  20.       replace keyword with words[jj],id_code with cId_code
  21.    endif
  22. next
  23. return NIL
  24.  
  25.  
  26. function keyw_find(cWord)
  27. LOCAL arr_ :={}
  28. use VIDEOS new index VIDS
  29. use KEYWORD new index KEYW
  30. select KEYWORD
  31. seek upper(cWord)
  32. while !eof() .and. upper(cWord) = KEYWORD->keyword
  33.    select VIDEOS
  34.    seek KEYWORD->id_code
  35.    if found()
  36.       Aadd(arr_,VIDEOS->title+' '+VIDEOS->id_code)
  37.    endif
  38.    select KEYWORD
  39.    skip +1
  40. enddo
  41. return arr_
  42.  
  43. // end of file CHP1908.PRG
  44.