]> Cypherpunks repositories - gostls13.git/commit
bytes, strings: add Replace
authorRuss Cox <rsc@golang.org>
Thu, 1 Jul 2010 01:03:09 +0000 (18:03 -0700)
committerRuss Cox <rsc@golang.org>
Thu, 1 Jul 2010 01:03:09 +0000 (18:03 -0700)
commit0bf413ab8e24fd0c19c14782278fc94aa2d0de18
treed380d0f33dc266caf1a33dcd6492fad0bf957ca1
parent269df5827010fa29822d0ed655e104b559f1e870
bytes, strings: add Replace

This is the Replace I suggested in the review of CL 1114041.
It's true that we already have

regexp.MustCompile(regexp.QuoteMeta(old)).ReplaceAll(s, new)

but because this Replace is doing a simpler job it is
simpler to call and inherently more efficient.

I will add the bytes implementation and tests to the
CL after the strings one has been reviewed.

R=r, cw
CC=golang-dev
https://golang.org/cl/1731048
src/pkg/bytes/bytes.go
src/pkg/bytes/bytes_test.go
src/pkg/strings/strings.go
src/pkg/strings/strings_test.go