What's the best way to manipulate strings in Golang? or How do you efficiently work with strings in G

16 Replies, 1863 Views

Honestly, the strings package is *chef’s kiss* for most things.

But if you’re doing regex stuff, don’t sleep on `regexp` package. It’s not always the fastest, but for complex patterns, it’s worth it.

Also, `fmt.Sprintf` is my go-to for quick string formatting. Not for heavy lifting, but super handy.

Pro tip: `strings.Join` >>> looping with `+=`. Way cleaner.

Messages In This Thread



Users browsing this thread: 1 Guest(s)