Boost logo

Boost Users :

From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2005-01-19 16:53:33


Pavol Droba wrote:
> On Wed, Jan 19, 2005 at 03:09:57PM -0500, Jeff Flinn wrote:
>> Am I required to use regex_finder to replace repeated chars with a
>> single instance? I'm trying to cleanup a string for use with
>> filesystem::path, for example:
>>
>> C:\\abc///def\\ghi => C:\abc\def\ghi
>>
>> There may be mixed forward and back-slashes. These are from
>> environment variables that apparently are required by our use of
>> NutCracker to support legacy apps under windows.
>>
>> If I need to use regex_finder what are the benefits of the
>> string_algo versus just using the regex library?
>>
>
> Actualy you can do it without regex. You need to use token_finder and
> find_format.
>
> <code>
>
> string strPath=find_format_all_copy(
> "C:\\abc\\def//ghi",
> token_finder(is_any_of("\\/"), token_compress_on),
> const_formatter("\\"));
>
> //strPath == C:\abc\def\ghi
>
> </code>

Great!

I'm just having a little trouble finding my way around the library. I was
stuck on looking for a replace algorithm variant to do what I needed. I need
to spend an evening studying the doc's I see.

One suggestion I have is to add to the Quick Reference table, the req'd
header. This would help newbies(me) get up and running faster.

Thanks, Jeff


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