2020-02-26 12:22:12 +00:00
|
|
|
module strings
|
|
|
|
|
|
|
|
pub fn repeat(c byte, n int) string {
|
|
|
|
if n <= 0 {
|
|
|
|
return ''
|
|
|
|
}
|
2020-08-10 16:05:26 +00:00
|
|
|
arr := [c].repeat(n)
|
|
|
|
return arr.bytestr()
|
2020-02-26 12:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn repeat_string(s string, n int) string {
|
2021-10-04 15:28:30 +00:00
|
|
|
res := ''
|
|
|
|
#res.str = s.str.repeat(n.valueOf())
|
|
|
|
|
2020-02-26 12:22:12 +00:00
|
|
|
return res
|
|
|
|
}
|