Boost logo

Boost Users :

Subject: Re: [Boost-users] [string_algo] replace string with tokens
From: Michael Schuster (schuster_at_[hidden])
Date: 2009-06-04 11:57:21


>> I'm not sure what you mean with 'replace command'.
>> boost::algorithm::replace_all() simply replaces a substring with another.If
>> you mean boost::algorithm::split() you can pass a predicate as the third
>> parameter (boost::algorithm::is_punct() might help).
Well I didnot find replace_all in usage of the bib. Now that you tell me, i
can find it.
But here I see no way to tell replace_all that my strings are not seperated by
spaces but +*() etc.
         a+3*sin(b)

So what I had expected is like this:
string str="a+3*sin(b)";
replace_all(str,"b", "Beta", "+*()") // now str="a+3*sin(Beta)";

Perhaps a task for tokenizer(?)
>For what you are doing, perhaps regex_replace in Boost.Xpressive might
>be more useful?
I'll have a look

Thanks
Michael Schuster


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