Removing punctuations from a given string
Given a string, remove the punctuation from the string if the given character is a punctuation character as classified by the current C locale. The default C locale classifies these characters as punctuation:
Input : %welcome' to @geeksforgeek<s Output : welcome to geeksforgeeks Input : Hello!!!, he said ---and went. Output : Hello he said and went
A loop is designed that goes through a list composed of the characters and punctuations of that string, removes the punctuation and then joins them.
Welcome to GeeksforGeeks
This article is contributed by Pramod Kumar. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Participate in the Scholorship Test for First-Step-to-DSA Course for Class 9 to 12 students.