|
Boost : |
From: Gary Powell (powellg_at_[hidden])
Date: 2001-12-10 13:09:19
How about adding this as an example to the documentation, seems like a
common enough case.
Yours,
-gary-
-----Original Message-----
From: jbandela_at_[hidden] [mailto:jbandela_at_[hidden]]
Sent: Saturday, December 01, 2001 1:08 PM
To: boost_at_[hidden]
Subject: [boost] Re: Tokenizing Floating point numbers.
Sorry, my mistake.
punct_space_separator should have been char_delimiters_separator
Below is a simple test program. Hope this helps.
Regards,
John R. Bandela
#include <iostream>
#include <boost/tokenizer.hpp>
#include <string>
#include <algorithm>
#include<iterator>
int main() {
using namespace boost;
using namespace std;
string s = "{0 0.23 56 45.456}" ;
char_delimiters_separator<char> sep(false,"{}");
tokenizer<> tok(s,sep);
copy(tok.begin(),tok.end(),ostream_iterator<string>(cout,"\n"));
cin.get();
}
Regards,
John R. Bandela
--- In boost_at_y..., dejavous_ie_at_y... wrote:
> Mr Bandela,
> Thank you for the help but I cannot get what you suggested to
work. When I enter the punct_space_separator<char> sep(false,"()");
line the compiler throws errors saying that this is undeclard and the
first use of this function.
>
> Thanks for your time.
>
> --- In boost_at_y..., jbandela_at_u... wrote:
> > This should work
> >
> > using namespace boost;
> > string s = "{0 0.23 56 45.456}"
> > punct_space_separator<char> sep(false,"()");
> > tokenizer<> tok(s,sep);
> >
> >
> > The reason this works is that it overrides the default ispunct to
> > pick delimiters.
> >
> > Regards,
> >
> > John R. Bandela
Info: http://www.boost.org Unsubscribe:
<mailto:boost-unsubscribe_at_[hidden]>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk