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
.