diff options
| author | Russ Cox <rsc@golang.org> | 2009-11-20 11:45:05 -0800 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2009-11-20 11:45:05 -0800 |
| commit | c861f30835090bbd6b9b35a80667f26952843767 (patch) | |
| tree | 645bd57ef3c9326ec02e646a751b9075d12a79e7 /src/pkg/regexp/regexp.go | |
| parent | 7089e97992d5d6be520dfea787200061992526c8 (diff) | |
| download | golang-c861f30835090bbd6b9b35a80667f26952843767.tar.gz | |
gofmt -r 'α[β:len(α)] -> α[β:]' -w src/cmd src/pkg
R=r, gri
CC=golang-dev
http://codereview.appspot.com/156115
Diffstat (limited to 'src/pkg/regexp/regexp.go')
| -rw-r--r-- | src/pkg/regexp/regexp.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/pkg/regexp/regexp.go b/src/pkg/regexp/regexp.go index 30043fcb9..8f17954d7 100644 --- a/src/pkg/regexp/regexp.go +++ b/src/pkg/regexp/regexp.go @@ -265,7 +265,7 @@ func (p *parser) nextc() int { if p.pos >= len(p.re.expr) { p.ch = endOfFile } else { - c, w := utf8.DecodeRuneInString(p.re.expr[p.pos:len(p.re.expr)]); + c, w := utf8.DecodeRuneInString(p.re.expr[p.pos:]); p.ch = c; p.pos += w; } @@ -804,9 +804,9 @@ func (re *Regexp) doExecute(str string, bytestr []byte, pos int) []int { if re.prefix != "" { var advance int; if bytestr == nil { - advance = strings.Index(str[pos:len(str)], re.prefix) + advance = strings.Index(str[pos:], re.prefix) } else { - advance = bytes.Index(bytestr[pos:len(bytestr)], re.prefixBytes) + advance = bytes.Index(bytestr[pos:], re.prefixBytes) } if advance == -1 { return []int{} @@ -1014,7 +1014,7 @@ func (re *Regexp) ReplaceAllString(src, repl string) string { lastMatchEnd = a[1]; // Advance past this match; always advance at least one character. - _, width := utf8.DecodeRuneInString(src[searchPos:len(src)]); + _, width := utf8.DecodeRuneInString(src[searchPos:]); if searchPos+width > a[1] { searchPos += width } else if searchPos+1 > a[1] { @@ -1027,7 +1027,7 @@ func (re *Regexp) ReplaceAllString(src, repl string) string { } // Copy the unmatched characters after the last match. - io.WriteString(buf, src[lastMatchEnd:len(src)]); + io.WriteString(buf, src[lastMatchEnd:]); return buf.String(); } @@ -1058,7 +1058,7 @@ func (re *Regexp) ReplaceAll(src, repl []byte) []byte { lastMatchEnd = a[1]; // Advance past this match; always advance at least one character. - _, width := utf8.DecodeRune(src[searchPos:len(src)]); + _, width := utf8.DecodeRune(src[searchPos:]); if searchPos+width > a[1] { searchPos += width } else if searchPos+1 > a[1] { @@ -1071,7 +1071,7 @@ func (re *Regexp) ReplaceAll(src, repl []byte) []byte { } // Copy the unmatched characters after the last match. - buf.Write(src[lastMatchEnd:len(src)]); + buf.Write(src[lastMatchEnd:]); return buf.Bytes(); } |
