FilterLine sends the contents of the pipe to the function filter, a line at a time, and produces the result. filter takes each line as a string and returns a string as its output. See [Pipe.Filter] for concurrency handling.
(filter func(string) string)
| 554 | // a time, and produces the result. filter takes each line as a string and |
| 555 | // returns a string as its output. See [Pipe.Filter] for concurrency handling. |
| 556 | func (p *Pipe) FilterLine(filter func(string) string) *Pipe { |
| 557 | return p.FilterScan(func(line string, w io.Writer) { |
| 558 | fmt.Fprintln(w, filter(line)) |
| 559 | }) |
| 560 | } |
| 561 | |
| 562 | // FilterScan sends the contents of the pipe to the function filter, a line at |
| 563 | // a time, and produces the result. filter takes each line as a string and an |