A little STL magic please?

This is a discussion on A little STL magic please? within the C++ Programming forums, part of the General Programming Boards category; I'm sorry for asking this, but is there any magically easy way to count the number of occourances of a ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    752

    A little STL magic please?

    I'm sorry for asking this, but is there any magically easy way to count the number of occourances of a substring in a string... for example,
    Code:
    3 == count ("abbabab", "ab");
    Except, it works?
    Callou collei we'll code the way
    Of prime numbers and pings!

  2. #2
    Unregistered
    Guest
    I think the function you are after is in <string.h> or <cstring>

  3. #3
    Unregistered
    Guest
    sorry, a little intoxicated
    here is the prototype -

    char* strstr( const char* s1, const char* s2 )

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help on magic square
    By katway in forum C Programming
    Replies: 2
    Last Post: 03-07-2005, 06:44 PM
  2. C Formatting Using STL
    By ChadJohnson in forum C++ Programming
    Replies: 4
    Last Post: 11-18-2004, 05:52 PM
  3. im extreamly new help
    By rigo305 in forum C++ Programming
    Replies: 27
    Last Post: 04-24-2004, 12:22 AM
  4. Prime Number Generator... Help !?!!
    By Halo in forum C++ Programming
    Replies: 9
    Last Post: 10-20-2003, 08:26 PM
  5. include question
    By Wanted420 in forum C++ Programming
    Replies: 8
    Last Post: 10-17-2003, 04:49 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21