String Fields Golang

// Golang program to illustrate the
// strings.Fields() Function
package main
  
import (
    "fmt"
    "strings"
)
  
func main() {
  
    // Fields function also splits the string
    // on the basis of white spaces and tabs
    s := strings.Fields(" I \t love \n to \n code \n all \t day.")
    fmt.Println(s)
  
    // Splits into 5 words which have
    // newline character in between
    s = strings.Fields("I\nam\nlearning\nGo\nlanguage")
    fmt.Println(s)
}
Ben Mulongo