Boost logo

Boost Users :

Subject: [Boost-users] String transformation using string_algo
From: Remko Tronçon (remko_at_[hidden])
Date: 2011-03-23 14:47:40


Hi,

I want to apply an (un-)escaping transformation on a string (e.g., map
"&lt;" to "<", map "&gt;" to "<", ...). I was wondering whether boost
string algorithms can provide a good way of doing this or not.

I was corsidering find_format, but the problem there is that the
finder has to check for occurrence of "&lt;" (by matching a string),
but then the formatter needs to check again which of the strings the
finder matched ("&lt;", "&gt;") to emit the correct character, which
sounds suboptimal. A workaround would be to make the finder always
succeed, and let the formatter do the actual check and emit the string
if it matches. Is there a better alternative?

I also noticed there's a "transform_range_copy", but this isn't documented.

thanks!
Remko


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