home *** CD-ROM | disk | FTP | other *** search
/ Power CD-ROM!! 7 / POWERCD7.ISO / prgmming / clipper / namecoun.prg < prev    next >
Text File  |  1993-10-14  |  2KB  |  68 lines

  1. /*
  2.  * File......: NAMECOUN.PRG
  3.  * Author....: Martin Colloby
  4.  * BBS.......: The Dark Knight Returns
  5.  * Net/Node..: 050/069
  6.  * User Name.: Martin Colloby
  7.  * Date......: 18/4/93
  8.  * Revision..: 1.0
  9.  *
  10.  * This is an original work by Martin Colloby and is placed in the public
  11.  * domain.
  12.  *
  13.  * Modification history:
  14.  * ---------------------
  15.  *
  16.  * $Log$
  17.  *
  18.  */
  19.  
  20.  
  21. /*  $DOC$
  22.  *  $FUNCNAME$
  23.  *      GT_NAMECOUNT()
  24.  *  $CATEGORY$
  25.  *      String
  26.  *  $ONELINER$
  27.  *      Count the number of elements in a delimited string
  28.  *  $SYNTAX$
  29.  *      GT_NameCount( cString )
  30.  *  $ARGUMENTS$
  31.  *      cString - Delimited string, delimited by it's first character
  32.  *  $RETURNS$
  33.  *      Number of elements in string
  34.  *  $DESCRIPTION$
  35.  *      Count the number of elements in a delimited string
  36.  *  $EXAMPLES$
  37.  *
  38.  *  $SEEALSO$
  39.  *
  40.  *  $INCLUDE$
  41.  *      GT_LIB.CH
  42.  *  $END$
  43.  */
  44.  
  45. *
  46. #include "GT_LIB.ch"
  47.  
  48. FUNCTION GT_NameCount( cString )
  49.  
  50. /****************************************************************************
  51.  Purpose - Count number of elements in cString
  52.  Returns - Number of occurences
  53.  Author  - Martin Colloby
  54.  Created - 29/8/90
  55.  Edited  - 3/10/60 by Martin Colloby
  56. ******************************************************************************
  57.  Parameters - cString    - Delimited string
  58.  Privates   - cDelimiter - Delimiting character
  59.  Externals  - None
  60. ****************************************************************************/
  61.  
  62. LOCAL cDelimiter := SUBSTR( cString , 1 , 1 )
  63.  
  64. * Count the number of occurences of the delimiting character, and subtract
  65. * one - for the first character
  66. RETURN( GT_Occurs( cDelimiter , cString ) - 1 )
  67. *
  68.