Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- GT_LIB v1.0 Reference Guide Release 1.0 - <b>count the number of times a substring appears in a string</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 Count the number of times a substring appears in a string
------------------------------------------------------------------------------

 Syntax

        GT_StrCount(<cChrs>, <cStr>) --> nFreq

 Arguments:

      <cChrs> - The substring to find the frequence of
      <cStr>  - The string in which to find the character

 Returns:

      nFreq   - The number of times <cChrs> occurs in <cStr>

 Description:

      GT_StrCount() counts how many times a specified substring
      appears in a string.
      If the substring does NOT appear in <cStr> this function
      will return 0.
      If the substring is a single character use GT_ChrCount() as
      it will be faster.

      NOTE:
         invalid parameters will return -1

 Examples:


      ? GT_StrCount("the", "the cat sat on the mat")      // prints 2


 Source: STRCOUNT.C

 Author:  Andy M Leighton

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson