diff options
| author | mo khan <mo.khan@gmail.com> | 2019-10-26 12:02:55 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2019-10-26 12:02:55 -0600 |
| commit | fa865f49bba601bc1f9c49c0b0f56d58fa8f32b6 (patch) | |
| tree | 6a1add445b4a397d4c8f598db631395e0e2a7b8f /repeat.go | |
| parent | 1e52b71575b694e370e46c2cc81f322db1b176c2 (diff) | |
https://golang.org/pkg/strings/#Repeat
Diffstat (limited to 'repeat.go')
| -rw-r--r-- | repeat.go | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -1,9 +1,7 @@ package main +import "strings" + func Repeat(character string, times int) string { - var repeated string - for i := 0; i < times; i++ { - repeated += character - } - return repeated + return strings.Repeat(character, times) } |
