Skip to content

Instantly share code, notes, and snippets.

@flaviocopes
Last active June 23, 2024 09:05
Show Gist options
  • Save flaviocopes/6717857ca7ba7266d41330329eeb5ad0 to your computer and use it in GitHub Desktop.
Save flaviocopes/6717857ca7ba7266d41330329eeb5ad0 to your computer and use it in GitHub Desktop.
Go: check if a string starts with a substring #golang
package main
import (
"strings"
)
func main() {
strings.HasPrefix("foobar", "foo") // true
}
@stephennancekivell
Copy link

Still going strong in 2022!

@NiklasZeroZero
Copy link

Danke

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment