|
Boost : |
From: lattice (zhangwusheng_at_[hidden])
Date: 2003-07-21 05:20:10
thanks Russell Hind &Gennadiy Rozental
I got it.
"Russell Hind" <rhind_at_[hidden]> ???? news:bf0d75$o3h$1_at_main.gmane.org...
> You need to pass a separator into the tokenizer that only separates on
> ',' (i'm not sure if this code compiles, but you get the idea
>
> std::string Pages("2,3,5-7");
> char_separator<char> CommaSep(",");
> tokenizer<char_separator<char> > Tokenizer(Pages,CommaSep);
>
> This will split it up into
>
> 2
> 3
> 5-7
>
> You will then need to do a bit of extra passing on each token to see if
> it is a range (contains a '-') using either just a find, or create
> another tokenizer for '-'
>
> Cheers
>
> Russell
>
>
> lattice wrote:
>
> > If we print some pages ,we can select pages in a range to print.
> > for example,if we enter 2,3,5-7 in Ms-word print dialog,then page
> > 2,3,5,6,7 is printed.
> > Now questions is :
> > if we get a string like this "2,3,5-7",if we use boost::tokenizer,
> > we can only get 2,3,5,7. eventually some information is lost.
> >
> > How can we get the desired result----"2,3,5,6,7" using boost::tokenizer?
> >
> >
> >
> >
> > _______________________________________________
> > Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
> >
>
>
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk