Boost logo

Boost Users :

Subject: [Boost-users] [string algorithms] finding last digit
From: Peter Barker (newbarker_at_[hidden])
Date: 2008-09-09 09:29:57


Hello,

I have the following program:

#include <string>

#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/finder.hpp>

int main()
{
        std::string str("12.5e");

        boost::last_finder(str,boost::is_digit()); // <--- is this sort of right?
}

What I'm trying to do is find the last occurence of a digit in my
string (and learn a bit more about Boost.StringAlgorithms!). Am I
going down the correct route here, and if so would someone be so kind
to add to my program to show how I could obtain and output the index?
The call operator for last_finder accepts two paramters which has
thrown me as I thought the range was defined at construction.

Thanks in advance,

Pete


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