replace() Function
The replace() function returns a new string with all occurrences of oldChar (string to be replaced) replaced with newChar (string to replace with).
Syntax:
fun String.replace(
oldChar: Char,
newChar: Char,
ignoreCase: Boolean = false
): String
Kotlin program to demonstrate the example of replace() function
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer