PeakGen PeakGen - 9 months ago 25
Java Question

Removing full stops from String

I am trying to remove full stops from a String. I have tried the below

titleAndBodyContainer = titleAndBodyContainer.replaceAll("\\.", " ");

Unfortunately, this removed all other 'dots' as well. My paragraph includes dates like Jan.13, 2014 , words like U.S and numbers like 2.2. How can I remove only the full stops?


I'd do:

titleAndBodyContainer = titleAndBodyContainer.replaceAll("\\.(?=\\s|$)", " ");