String algorithm? Removing non-alphanumerics from a string
Hi, Takeing an std::string as input, I need to return the same string with any characters not in the ranges "az", "AZ" and "09" being discarded. A colleague told me that a could use something in the string algorithm library, but I'm obviously not spotting what I need. I tried regex replace, but failed, as I'm not understanding regular expressions yet. Any and all suggestions would be gratefully received. Best wishes. Tim Burgess
On 10/18/2013 08:05 PM, Tim Burgess wrote:
Takeing an std::string as input, I need to return the same string with any characters not in the ranges “az”, “AZ” and “09” being discarded. A
#include
Many thanks for this - I'll give it a spin. Best wishes. Tim Burgess -----Original Message----- From: Boost-users [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Bjorn Reese Sent: 19 October 2013 12:03 To: boost-users@lists.boost.org Subject: Re: [Boost-users] String algorithm? Removing non-alphanumerics from a string On 10/18/2013 08:05 PM, Tim Burgess wrote:
Takeing an std::string as input, I need to return the same string with any characters not in the ranges "az", "AZ" and "09" being discarded. A
#include
Gesendet: Freitag, 18. Oktober 2013 um 20:05 Uhr Von: "Tim Burgess"
An: "'boost-users list'" Betreff: [Boost-users] String algorithm? Removing non-alphanumerics from a string Hi, Takeing an std::string as input, I need to return the same string with any characters not in the ranges “az”, “AZ” and “09” being discarded. A colleague told me that a could use something in the string algorithm library, but I’m obviously not spotting what I need. I tried regex replace, but failed, as I’m not understanding regular expressions yet. Any and all suggestions would be gratefully received. Best wishes. Tim Burgess
std::remove_if with a predicate? Maybe std::isalnum would already do the job... kind regards, Jens Weller
participants (3)
-
Bjorn Reese
-
Jens Weller
-
Tim Burgess