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