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