Remove/erase

Is it possible to delete from the beginning of a string up to (and including) a tab?

I know you can delete a specified amount of characters, but what if I have multiple strings which vary in length before the tab?

Thanks
1
2
3
std::string s = "Chapter 1\tstd::string";
std::string::size_type pos = s.find("\t");
s.erase(0,++pos);
Last edited on
Thanks Texan40. That was nice and simple!

I altered your code ever so slightly to make sure the actual tab was removed too:

 
s.erase(0,pos+1);


Thanks a lot
Yeah I caught that and edited it but after the fact =]
Topic archived. No new replies allowed.