mirror of
https://github.com/unidoc/unioffice.git
synced 2025-04-29 13:49:10 +08:00
14 lines
213 B
Go
14 lines
213 B
Go
![]() |
package algo
|
||
|
|
||
|
func RepeatString(s string, cnt int) string {
|
||
|
if cnt <= 0 {
|
||
|
return ""
|
||
|
}
|
||
|
buf := make([]byte, len(s)*cnt)
|
||
|
sb := []byte(s)
|
||
|
for i := 0; i < cnt; i++ {
|
||
|
copy(buf[i:], sb)
|
||
|
}
|
||
|
return string(buf)
|
||
|
}
|