Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 708 Bytes

File metadata and controls

38 lines (26 loc) · 708 Bytes
name replace
menu string

string/replace

replace :: String -> String -> String -> String

Replaces all instances of pattern with a replacement in a string.

Example

import { log, pipe, run, replace } from 'mojiscript'

const state = 'JavaScript JavaScript JavaScript!'

const main = pipe ([
  replace ('Java') ('Moji'),
  log
])

run ({ state, main })
// => "MojiScript MojiScript MojiScript!"

Parameters

Name Type Description
pattern String Pattern to search for.
replacement String Replacement String.
string String String to to perform replacement.

Returns

Replaced String.