Skip to content

Instantly share code, notes, and snippets.

@teivah
Created December 1, 2022 08:46
Show Gist options
  • Save teivah/67d573d794cce83d111ebe6ff2395e27 to your computer and use it in GitHub Desktop.
Save teivah/67d573d794cce83d111ebe6ff2395e27 to your computer and use it in GitHub Desktop.
func concat(values []string) string {
total := 0
for i := 0; i < len(values); i++ {
total += len(values[i])
}
sb := strings.Builder{}
sb.Grow(total)
for _, value := range values {
_, _ = sb.WriteString(value)
}
return sb.String()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment