MCPcopy Index your code
hub / github.com/bitfield/script / Replace

Method Replace

script.go:837–841  ·  view source on GitHub ↗

Replace replaces all occurrences of the string search with the string replace.

(search, replace string)

Source from the content-addressed store, hash-verified

835// Replace replaces all occurrences of the string search with the string
836// replace.
837func (p *Pipe) Replace(search, replace string) *Pipe {
838 return p.FilterLine(func(line string) string {
839 return strings.ReplaceAll(line, search, replace)
840 })
841}
842
843// ReplaceRegexp replaces all matches of the compiled regexp re with the string
844// replace. $x variables in the replace string are interpreted as by

Calls 1

FilterLineMethod · 0.95

Tested by 2

ExamplePipe_ReplaceFunction · 0.64