Boost logo

Boost :

From: johan.nilsson_at_[hidden]
Date: 2001-08-28 01:23:52


Yes,

and thanks for replying. However that's exactly what Gennadiy proposed in
the initial response to my question, but it doesn't really appeal to me (too
much of a workaround).

But, as I seem to be alone in my opinion, I'll leave the topic on this list
and fix it myself :)

// Johan

> -----Original Message-----
> From: Jeroen [mailto:jeroen_at_[hidden]]
> Sent: den 27 augusti 2001 19:12
> To: boost_at_[hidden]
> Subject: RE: [boost] Re: Tokenizer and empty tokens
>
>
> I'm fairly new to Boost, but the following seems to work:
>
> #include<iostream>
> #include<boost/tokenizer.hpp>
> #include<string>
>
> int main(){
> using namespace boost;
> string s = "$GPGSA,A,3,25,04,16,06,18,24,,,,,,,1.86,0.92,1.62*0E";
> char_delimiters_separator<char> d(true,"$,*","");
> tokenizer<char_delimiters_separator<char> > tok(s, d);
> for(tokenizer<char_delimiters_separator<char> >::iterator
> beg=tok.begin(); beg!=tok.end();++beg){
> cout << *beg << "\n";
> }
> }
>
> The output includes the separators, which makes it a simple
> matter to figure
> out when you have an <empty> token (This is the case if the
> current and the
> previous token are both separators).
>
> Jeroen
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk