Skip to content

Instantly share code, notes, and snippets.

View flaviocopes's full-sized avatar

Flavio Copes flaviocopes

View GitHub Profile
@flaviocopes
flaviocopes / check-substring-ends-with.go
Last active November 15, 2021 09:34
Go: check if a string ends with a substring #golang
package main
import (
"strings"
)
func main() {
strings.HasSuffix("foobar", "bar") // true
}
@flaviocopes
flaviocopes / check-substring-starts-with.go
Last active April 16, 2023 03:02
Go: check if a string starts with a substring #golang
package main
import (
"strings"
)
func main() {
strings.HasPrefix("foobar", "foo") // true
}