Answers for "golang how to get a string from a txt file"

2

golang read file

dat, err := ioutil.ReadFile("/tmp/dat")
    check(err)
    fmt.Print(string(dat))
Posted by: Guest on November-02-2020
0

read contents of a file and convert to list + go

content, err := ioutil.ReadFile(filename)
if err != nil {
    //Do something
}
lines := strings.Split(string(content), "n")
Posted by: Guest on August-05-2020

Code answers related to "golang how to get a string from a txt file"

Browse Popular Code Answers by Language