2.12.0
Carbon.String.replaceOnce(string, search, replace)
Helper to replace the first occurrence of a string.
Examples:
Expression | Result |
---|---|
Carbon.String.replaceOnce('Foo Bar Foo', 'Foo', 'X') |
'X Bar Foo' |
Carbon.String.replaceOnce('Foo Bar Foo', 'Foo ') |
'Bar Foo' |
string
(string) The string being searched and replaced onsearch
(string) The value being searched forprefix
(string, optional) The replacement value that replaces found search value
Returns the string with one occurrence replaced
Full Changelog: 2.11.0...2.12.0