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
}
@PeterlitsZo
Copy link

so... how to let regex string match the begining?

@zplusfour
Copy link

thanks!

@lawliet-cpp
Copy link

Thanks!

@jonton11
Copy link

Thank you!

@ckcr4lyf
Copy link

thank

@spatecon
Copy link

Merci!

@StevenConradEllis
Copy link

Gracias!

@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