Skip to content

replace

replace(pattern, replacement): (s) => string

Defined in: Data/Str.ts:56

Replaces the first occurrence of a pattern in a string. Data-last: use in pipe.

string | RegExp

string

(s) => string

pipe("foo foo foo", Str.replace("foo", "bar")); // "bar foo foo"
pipe("Hello World", Str.replace(/world/i, "Earth")); // "Hello Earth"