How to replace a String in java which contains dot?
escape the dot, or else it will match any character. This escaping is necessary, because replaceAll() treats the first paramter as a regular expression.
customerName = customerName.replaceAll("\\.", "");
You can do the whole thing with one statement:
customerName = customerName.replaceAll("[\\s.]", "");
use this in your code just for remove periods
customerName = customerName.replaceAll("[.]","");