Boost logo

Boost Users :

Subject: [Boost-users] xpressive - delete weird character is a string
From: Jean-Christophe Roux (jcxxr_at_[hidden])
Date: 2010-12-23 15:09:24


Hello,

I have strings coming from a webpage (through a post form and fastcgi
application) that contain "weird characters".
In vim, those characters appears like ^@ in blue. Those weird characters were
not there in the web form but are there in my fasctcgi application.
I suspect they appear like that because of issues with charset but I am not
sure.

I would like to have a function to remove those weird characters from the
strings and I would think that xpressive would be a good tool for that.

When the weird characters are at the ends of the string, I trim using this
function and the boost algo library

 void
 remove_non_graph(std::string& str)
 {
   using namespace boost;
   trim_if(str, !is_print());
   return;
 }

but this does not work when the weird character is inside the string or there
are break lines.

Is there an easy way to clean those strings with xpressive?

Thank you
Jean

      



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