dt_automate/vendor/github.com/Esword618/unioffice/algo/strings.go
2025-02-26 23:15:11 +08:00

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)
}