home *** CD-ROM | disk | FTP | other *** search
/ HomeWare 14 / HOMEWARE14.bin / prog / ks94an.arj / WHICH_E.HDR < prev    next >
Text File  |  1994-04-24  |  1KB  |  58 lines

  1. /******************************************************************************
  2.                  The Klipper Library, for CA-Clipper 5.x
  3.         Copyright (c), 1994, Wallace Information Systems Engineering
  4.  
  5. FUNCTION:
  6.  
  7. _Which_Element( aArrayName, cString, lBegins ) --> nElementNumber
  8.  
  9. PARAMETERS:
  10.  
  11. aArrayName : Array to search
  12. cString    : String to search for
  13.  
  14. SHORT:
  15.  
  16. Scan an array looking for the element that contains the specified value.
  17.  
  18. DESCRIPTION:
  19.  
  20. _Which_Element() searches a character array for a particular value and
  21. returns the element number that matches the search criteria or zero if not
  22. found.
  23.  
  24. If lBegins is TRUE, cString must BEGIN at position 1. (DEFAULT)
  25. If lBegins is false, cString may occur anywhere in the element.
  26.  
  27. NOTE:
  28.  
  29. This function differs from ASCAN() only in that it will return the element
  30. number that contains the specified data ANYWHERE in the element (not just at
  31. the beginning).  It can be made to operate identically to ASCAN() by
  32. specifying TRUE in lBegins.
  33.  
  34. EXAMPLE:
  35.  
  36. #include "klipper.ch"
  37.  
  38. PRIVATE Names[5]
  39. names[1] = 'John'
  40. names[2] = 'James'
  41. names[3] = 'Jenifer'
  42. names[4] = 'Jeremy'
  43. names[5] = 'Jacob'
  44.  
  45. t = _Which_Element(Names,'Jenifer',TRUE)
  46. Result: t = 3
  47.  
  48. t = _Which_Element(Names,'Jenifer')
  49. Result: t = 3
  50.  
  51. t = _Which_Element(Names,'Frank')
  52. Result: t = 0
  53.  
  54. t = _Which_Element(Names,'rem',FALSE)
  55. Result: t = 4
  56.  
  57. ******************************************************************************/
  58.