Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
You're correct, and I would certainly use a Builder even on short strings.
I wrote this solution when I was brand new to Go and had to pick it up quickly while moving teams at work. I don't think my solution is best practice despite the 12 votes :D
Based on my understanding of string concatenation, for long strings your function may have performance loss.
The reason would be that additional memory allocations will be made with every string concatentation.
You may find using a
strings.Builder
would help with performance (on long strings) due to less memory allocations being made.Length property is not calculated.