c++ - How to remove punctuation around a string -
i want remove punctuation around string such string:
!dont't?. will becomes:
don't i have seem able remove punctuation in string with:
int len = str.size(); (int = 0; < len; i++){ if (ispunct(str[i])){ str.erase(i--, 1); len = str.size(); } } do guys know simple way rid of punctuation front , only?
yes, can use boost::trim_if (see work):
boost::trim_if(str, boost::is_punct());
Comments
Post a Comment