PeakGen PeakGen - 2 years ago 80
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?

Answer Source

I'd do:

titleAndBodyContainer = titleAndBodyContainer.replaceAll("\\.(?=\\s|$)", " "); 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download