Accessing the individual words of the content a file

2 days ago 5
ARTICLE AD BOX

I am working on a project whereby I want to access the individual words in a file and not the individual character eg. "Welcome to my world" should be equal to "Welcome" "to" "my" "world".

package main import ("fmt" "os" ) func main(){ file, err := os.ReadFile("sample.txt") if err != nil { fmt.Println("An error occures when trying to read the file") } for i := 0; i < len(file); i++{ fmt.Println(string(file[i])) } }
Read Entire Article