go/src/strings
Martin Möhrmann 3259bc4419 strings, bytes: add ToValidUTF8
The newly added functions create a copy of their input with all bytes in
invalid UTF-8 byte sequences mapped to the UTF-8 byte sequence
given as replacement parameter.

Fixes #25805

Change-Id: Iaf65f65b40c0581c6bb000f1590408d6628321d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/142003
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-01 18:31:47 +00:00
..
builder.go strings: add Builder.Cap 2018-08-20 13:04:52 +00:00
builder_test.go strings: add Builder.Cap 2018-08-20 13:04:52 +00:00
compare.go
compare_test.go strings: lower running time of TestCompareStrings 2018-11-04 18:55:55 +00:00
example_test.go strings: add ReplaceAll example 2018-12-13 00:35:06 +00:00
export_test.go strings: select Replacer algorithm and build machine lazily 2018-08-21 02:50:58 +00:00
reader.go bytes, strings: fix Reader.UnreadRune returning without error on a zero Reader 2018-10-29 20:07:25 +00:00
reader_test.go bytes, strings: fix Reader.UnreadRune returning without error on a zero Reader 2018-10-29 20:07:25 +00:00
replace.go strings: document that NewReplacer can panic 2019-04-03 20:15:58 +00:00
replace_test.go strings: speed up Map 2017-02-24 22:53:05 +00:00
search.go all: update comment URLs from HTTP to HTTPS, where possible 2018-06-01 21:52:00 +00:00
search_test.go all: update comment URLs from HTTP to HTTPS, where possible 2018-06-01 21:52:00 +00:00
strings.go strings, bytes: add ToValidUTF8 2019-05-01 18:31:47 +00:00
strings_test.go strings, bytes: add ToValidUTF8 2019-05-01 18:31:47 +00:00