4.17.11
3.10.1
2.4.2
1.3.1
_.replace([string=''], pattern, replacement)
Replaces matches for pattern
in string
with replacement
.
Note: This method is based on
String#replace
.
Since
4.0.0
Arguments
argument
[string='']
pattern
replacement
type
string
(RegExp|string)
(Function|string)
description
The string to modify.
The pattern to replace.
The match replacement.
Returns
(array)
Example
_.replace("Hi Fred", "Fred", "Barney");
// => 'Hi Barney'
_.replace("Hi Fred", "Fred", "Barney");
// => 'Hi Barney'