Browse Source

Merge pull request #432 from btipling/fix_trimsplit

Trimsplit Wasn't using separator, more efficient.
Xiang Li 12 years ago
parent
commit
fd0d0813ce
1 changed files with 3 additions and 4 deletions
  1. 3 4
      server/util.go

+ 3 - 4
server/util.go

@@ -37,10 +37,9 @@ func redirect(hostname string, w http.ResponseWriter, req *http.Request) {
 // slice of the substrings between the separator with all leading and trailing
 // slice of the substrings between the separator with all leading and trailing
 // white space removed, as defined by Unicode.
 // white space removed, as defined by Unicode.
 func trimsplit(s, sep string) []string {
 func trimsplit(s, sep string) []string {
-	raw := strings.Split(s, ",")
-	trimmed := make([]string, 0)
-	for _, r := range raw {
-		trimmed = append(trimmed, strings.TrimSpace(r))
+	trimmed := strings.Split(s, sep)
+	for i := range trimmed {
+		trimmed[i] = strings.TrimSpace(trimmed[i])
 	}
 	}
 	return trimmed
 	return trimmed
 }
 }