Skip to content

replace

Replaces all occurrences of the search string with the replacement string.

ParameterTypeRequiredDescription
strstringYesThe value to be replaced.
patternstring | RegExp YesThe value to match.
replacementstring | Function YesThe value to replace with.
ReturnsstringYesThe string with the replaced values.
ts
import { replace } from 'func-dash'
console.log(replace('Hello World', 'World', 'Dash')) // Hello Dash