github.com/ghodss/etcd@v0.3.1-0.20140417172404-cc329bfa55cb/pkg/strings/string.go (about) 1 package string 2 3 import ( 4 "strings" 5 ) 6 7 // TrimSplit slices s into all substrings separated by sep and returns a 8 // slice of the substrings between the separator with all leading and trailing 9 // white space removed, as defined by Unicode. 10 func TrimSplit(s, sep string) []string { 11 trimmed := strings.Split(s, sep) 12 for i := range trimmed { 13 trimmed[i] = strings.TrimSpace(trimmed[i]) 14 } 15 return trimmed 16 } 17 18 // Clone returns a copy of the string, so that we can safely point to the 19 // copy without worrying about changes via pointers. 20 func Clone(s string) string { 21 stringCopy := s 22 return stringCopy 23 }