There is no such thing as an "empty character". A char
is a value-type, so it has to have a value. An absence of a value is the absence of a char
- which is why you can have empty strings (i.e. "no characters") and a nullable char, but not an "empty char".
Anyway, the String.replace(char, char)
method is meant to substitute one character for another. This operation is very simple because it means that a single block of known size has to be allocated. Whereas String.replaceAll(string,string)
is a considerably more complicated method to implement, which is why they're different.
Unfortunately there is no String.replace(char,string)
method - but I hope you can understand why.