Computer Applications
Describe the purpose and write the syntax of replace() function.
Java String Handling
21 Likes
Answer
It replaces a character with another character or a substring with another substring at all its occurrences in the given string.
Syntax:
String <variable-name> = <string-variable>.replace(<character or substring to replace>, <new character or substring>);
Answered By
13 Likes