1
0
mirror of https://github.com/golang/go synced 2024-11-25 03:47:57 -07:00

regexp: name result parameters referenced from docs

Fixes #2953

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5653051
This commit is contained in:
Brad Fitzpatrick 2012-02-10 10:22:01 +11:00
parent 6bdd791dec
commit 9cd4a0467a

View File

@ -676,7 +676,7 @@ func (re *Regexp) FindString(s string) string {
// location of the leftmost match in s of the regular expression. The match // location of the leftmost match in s of the regular expression. The match
// itself is at s[loc[0]:loc[1]]. // itself is at s[loc[0]:loc[1]].
// A return value of nil indicates no match. // A return value of nil indicates no match.
func (re *Regexp) FindStringIndex(s string) []int { func (re *Regexp) FindStringIndex(s string) (loc []int) {
a := re.doExecute(nil, nil, s, 0, 2) a := re.doExecute(nil, nil, s, 0, 2)
if a == nil { if a == nil {
return nil return nil
@ -688,7 +688,7 @@ func (re *Regexp) FindStringIndex(s string) []int {
// location of the leftmost match of the regular expression in text read from // location of the leftmost match of the regular expression in text read from
// the RuneReader. The match itself is at s[loc[0]:loc[1]]. A return // the RuneReader. The match itself is at s[loc[0]:loc[1]]. A return
// value of nil indicates no match. // value of nil indicates no match.
func (re *Regexp) FindReaderIndex(r io.RuneReader) []int { func (re *Regexp) FindReaderIndex(r io.RuneReader) (loc []int) {
a := re.doExecute(r, nil, "", 0, 2) a := re.doExecute(r, nil, "", 0, 2)
if a == nil { if a == nil {
return nil return nil