diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2013-02-01 08:41:25 -0800 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2013-02-01 08:41:25 -0800 |
| commit | e515d80d5dfd5621a16f6fc9f08cc3c0958a8414 (patch) | |
| tree | 343538fd82efacfb61675e27dc2ebf19b0b6057e /src/pkg/exp | |
| parent | fe14ee52ccf89fa02366a06fe892a7fcf135e214 (diff) | |
| download | go-e515d80d5dfd5621a16f6fc9f08cc3c0958a8414.tar.xz | |
bytes, strings: add TrimPrefix and TrimSuffix
Everybody either gets confused and thinks this is
TrimLeft/TrimRight or does this by hand which gets
repetitive looking.
R=rsc, kevlar
CC=golang-dev
https://golang.org/cl/7239044
Diffstat (limited to 'src/pkg/exp')
| -rw-r--r-- | src/pkg/exp/html/parse_test.go | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/pkg/exp/html/parse_test.go b/src/pkg/exp/html/parse_test.go index 4896dfb7a0..f72af45970 100644 --- a/src/pkg/exp/html/parse_test.go +++ b/src/pkg/exp/html/parse_test.go @@ -42,10 +42,7 @@ func readParseTest(r *bufio.Reader) (text, want, context string, err error) { } b = append(b, line...) } - text = string(b) - if strings.HasSuffix(text, "\n") { - text = text[:len(text)-1] - } + text = strings.TrimSuffix(string(b), "\n") b = b[:0] // Skip the error list. |
