I need to remove punctuation following a word. For example, word?! should be changed to word and string: should be changed to string.
Edit: The algorithm should only remove punctuation at the end of the String. Any punctuation within the String should stay. For instance, doesn't; should become doesn't.
You could use a regex to modify the string.
There are no “words” that I know of where
'is at the end and it is used as a punctuation. So this regex will work for you.