Boost logo

Boost :

From: CN (cnliou9_at_[hidden])
Date: 2005-11-08 09:38:18


Hi! Thore,

> >I need to get non-null tokens from std::basic_string deliminated by null
> >characters. For example, hopefully the following code
> >
> >string str=string("X;Y\0\0Z\0",7);
> >typedef tokenizer<boost::escaped_list_separator<char> > Tok;
> >escaped_list_separator<char> sep(string(),string("\0;",2),string());
> >Tok tokens(str, sep);
> >for(Tok::iterator i = tokens.begin();i != tokens.end();++i)
> > cout << "<" << *i << ">";
> >
> >will yield
> >
> ><X><Y><Z>
> >
> >instead of
> >
> ><X><Y><><Z><>
> >.
>
> How about using the string_algo library instead? It handles NUL
> characters just fine.

The usage of split() is indeed neat and handy to myself.

Thank you very much!

CN

-- 
http://www.fastmail.fm - Access your email from home and the web

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