go i := 0
f := func (in string) (out string) {
i++
if i == 1 {
return "*"
}
return in
}
re, _ := regexp.Compile("e")
s := re.ReplaceAllStringFunc("Red Green Blue", f)
fmt.Println(s)
package main
import "fmt"
import "regexp"
func main() {
i := 0
f := func (in string) (out string) {
i++
if i == 1 {
return "*"
}
return in
}
re, _ := regexp.Compile("e")
s := re.ReplaceAllStringFunc("Red Green Blue", f)
fmt.Println(s)
}