I got a string and I want to remove all the punctuations from it. How do I do that? I did some research and found that people use the ispunct() function (I tried that), but
#include #include #include using namespace std; int main() { string str = "this. is my string. it's here."; transform(str.begin(), str.end(), str.begin(), [](char ch) { if( ispunct(ch) ) return '\0'; return ch; }); }