Skip to content

2.12.0

Compare
Choose a tag to compare
@jonnitto jonnitto released this 06 Feb 14:25
· 23 commits to master since this release
3db2043

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 on
  • search (string) The value being searched for
  • prefix (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