Boost logo

Boost Users :

Subject: [Boost-users] find substring and substring position
From: M (meirab_at_[hidden])
Date: 2009-01-12 16:10:22


hello all
---------

In:
http://www.boost.org/doc/libs/1_37_0/doc/html/string_algo/usage.html#id3676944

there is an example: Find Iterator

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
 string str1("abc-*-ABC-*-aBc");
    // Find all 'abc' substrings (ignoring the case)
    // Create a find_iterator
    typedef find_iterator<string::iterator> string_find_iterator;
    for(string_find_iterator It=
            make_find_iterator(str1, first_finder("abc", is_iequal()));
        It!=string_find_iterator();
        ++It)
    {
        cout << copy_range<std::string>(*It) << endl;
    }

    // Output will be:
    // abc
    // ABC
    // aBC
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

how do i find the position of each "abc" in: str1 ?

thank's
meir


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net