Java replace method, replacing with empty character
If you just exchange single for double quotes, this will work because an empty string is a legal value, as opposed to an "empty character", and there's an overload replace(CharSequence, CharSequence)
. Keep in mind that CharSequence
is the supertype of String
.
try :
string.replace(".", "");
Other way is to use replaceAll
:
string.replaceAll("\\.","");