By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,434 Members | 1,854 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,434 IT Pros & Developers. It's quick & easy.

String cleaning?

P: n/a
Given:

std::string s = "AGCTagct[]AgCt";

What is the best way to strip out the crappy chars? I only want to
allow AGCT non-case sensitive in any order.

B
Nov 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"Bryan" <sp**@nospam.com> wrote in message
news:44*******************@newssvr11.news.prodigy. com...
Given:

std::string s = "AGCTagct[]AgCt";

What is the best way to strip out the crappy chars? I only want to allow
AGCT non-case sensitive in any order.


(in a loop):

std::string::find_first_of(/* set of disallowed characters */)
or
std::string::find_first_not_of(/* set of allowed characters */)

std::string::erase()

-Mike
Nov 22 '05 #2

P: n/a
Bryan wrote:
Given:

std::string s = "AGCTagct[]AgCt";

What is the best way to strip out the crappy chars? I only want to
allow AGCT non-case sensitive in any order.


remove_if with a suitable predicate object.

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)
Nov 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.