# replace-first
Replace the first occurrence of a substring.
## Syntax
[replace-first $string $from $to]
## Examples
[replace-first "foo bar foo" "foo" "baz"] # "baz bar foo" [replace-first "a-b-c" "-" "+"] # "a+b-c" [replace-first "hello" "x" "y"] # "hello" (no match)
## Returns
New string with only the first match replaced; unchanged if `$from` is not found.
## See Also
`replace`, `index-of`, `contains`