Why doesn't this line of code work? It's supposed to replace all the punctuations with nothing.
m = m.replace("[\\?\\.;:'\"]", "")
m will not change after executing this line in java even though it contains punctuations. Why?
Why doesn't this line of code work? It's supposed to replace all the punctuations with nothing.
m = m.replace("[\\?\\.;:'\"]", "")
m will not change after executing this line in java even though it contains punctuations. Why?
This is because replace takes a String; you need to call replaceAll, which does take a regular expression.