Thread: A little STL magic please?

  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-23-2004, 11:22 PM
  4. Prime Number Generator... Help !?!!
    By Halo in forum C++ Programming
    Replies: 9
    Last Post: 10-20-2003, 07:26 PM
  5. include question
    By Wanted420 in forum C++ Programming
    Replies: 8
    Last Post: 10-17-2003, 03:49 AM