17 lines
300 B
Go
17 lines
300 B
Go
package iteration
|
|
|
|
import "strings"
|
|
|
|
// Repeat takes a string and repeat it 5 times
|
|
func Repeat(s string, repeatTime int) string {
|
|
// // Bench: 170ns
|
|
// var res string
|
|
// for i := 0; i < repeatTime; i++ {
|
|
// res += s
|
|
// }
|
|
// return res
|
|
|
|
// Bench: 70ns
|
|
return strings.Repeat(s, repeatTime)
|
|
}
|