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 contribute.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.
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Removing string that is an anagram of an earlier string
- Print string after removing all (“10” or “01”) from the binary string
- Removing spaces from a string using Stringstream
- Character replacement after removing duplicates from a string
- Find the resultant String after replacing X with Y and removing Z
- Modify string by removing vowels in between two consonants
- Print reverse string after removing vowels
- Balance a string after removing extra brackets
- Ways of transforming one string to other by removing 0 or more characters
- Lexicographically smallest string formed by removing at most one character
- Minimize the length of string by removing occurrence of only one character
- Reduce the string by removing K consecutive identical characters
- Minimum sum of squares of character counts in a given string after removing k characters
- Check if string remains palindrome after removing given number of characters
- Find longest palindrome formed by removing or shuffling chars from string
Improved By : 29AjayKumar