Skip to content

Instantly share code, notes, and snippets.

@greentornado
Created December 27, 2019 07:15
Show Gist options
  • Save greentornado/6e27c5fabb131774242b4cf97f74a636 to your computer and use it in GitHub Desktop.
Save greentornado/6e27c5fabb131774242b4cf97f74a636 to your computer and use it in GitHub Desktop.
Split string lines golang
package main
import (
"fmt"
"strings"
)
const s = `
one
two
three
billion
`
func main() {
fmt.Printf("%+q\n", strings.Split(s, "\n"))
fmt.Printf("%+q\n", strings.Split(s, `\n`))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment