replaceFirst
Replaces the first occurrence of the given regular expression regex in this char sequence with the specified replacement expression.
This is a convenience function that is equivalent to regex.replaceFirst(this, replacement)
. For details about its behaviour and the substitution syntax of replacement expression, refer to Regex.replaceFirst.
Since Kotlin
1.0Samples
Returns a new string with the first occurrence of oldChar replaced with newChar.
Since Kotlin
1.0Returns a new string obtained by replacing the first occurrence of the oldValue substring in this string with the specified newValue string.
Since Kotlin
1.0Since Kotlin
1.1Returns a new string with the first occurrence of oldChar replaced with newChar.
Since Kotlin
1.0Returns a new string obtained by replacing the first occurrence of the oldValue substring in this string with the specified newValue string.
Since Kotlin
1.0Returns a new string with the first occurrence of oldChar replaced with newChar.
Since Kotlin
1.3Returns a new string obtained by replacing the first occurrence of the oldValue substring in this string with the specified newValue string.
Since Kotlin
1.3Returns a new string with the first occurrence of oldChar replaced with newChar.
Since Kotlin
1.8Returns a new string obtained by replacing the first occurrence of the oldValue substring in this string with the specified newValue string.
Since Kotlin
1.8Returns a new string with the first occurrence of oldChar replaced with newChar.
Since Kotlin
1.8Returns a new string obtained by replacing the first occurrence of the oldValue substring in this string with the specified newValue string.