Which is the effective way to trim the leading and trailing white spaces of string variable in Go?
package main import ( "fmt" "strings" ) func main() { fmt.Println(strings.TrimSpace(" \t\n Hello, Gophers \n\t\r\n")) }
Output: Hello, Gophers
And simply follow this link - https://golang.org/pkg/strings/#TrimSpace