Generate a fresh string in which every “l” character is substituted with “p”
String |
The replace() method scans a string for a designated character and furnishes a new string with the designated character(s) substituted.
public String replace(char searchChar, char newChar) |
Parameter |
Description |
searchChar |
A character that indicates which character will be substituted with the new one. |
newChar |
A character that denotes the character to be substituted for the searchChar. |
Returns: |
A fresh String in which the specified character has been substituted with the new character(s). |