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

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -