String returns a transformer that replaces all instances of old with new. Unlike strings.Replace, empty old values don't match anything.
(old, new string)
| 47 | // String returns a transformer that replaces all instances of old with new. |
| 48 | // Unlike strings.Replace, empty old values don't match anything. |
| 49 | func String(old, new string) Transformer { |
| 50 | return Bytes([]byte(old), []byte(new)) |
| 51 | } |
| 52 | |
| 53 | // Transform implements golang.org/x/text/transform#Transformer |
| 54 | func (t Transformer) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { |