strings and bytes.Split: make count of 0 mean 0, not infinite.

Use a count of -1 for infinity.  Ditto for Replace.

R=rsc
CC=golang-dev
https://golang.org/cl/1704044
This commit is contained in:
Rob Pike 2010-07-01 14:08:14 -07:00
parent 285312a05c
commit 38f1231f3e
24 changed files with 123 additions and 98 deletions

View file

@ -236,7 +236,7 @@ func all(scripts map[string][]Script) []string {
// Extract the version number from the URL
func version() string {
// Break on slashes and look for the first numeric field
fields := strings.Split(*url, "/", 0)
fields := strings.Split(*url, "/", -1)
for _, f := range fields {
if len(f) > 0 && '0' <= f[0] && f[0] <= '9' {
return f
@ -304,7 +304,7 @@ func printCategories() {
return
}
// Find out which categories to dump
list := strings.Split(*tablelist, ",", 0)
list := strings.Split(*tablelist, ",", -1)
if *tablelist == "all" {
list = allCategories()
}
@ -580,7 +580,7 @@ func printScriptOrProperty(doProps bool) {
resp.Body.Close()
// Find out which scripts to dump
list := strings.Split(flaglist, ",", 0)
list := strings.Split(flaglist, ",", -1)
if flaglist == "all" {
list = all(table)
}