2020-02-26 13:22:12 +01:00
|
|
|
module strings
|
|
|
|
|
2022-04-15 17:25:45 +02:00
|
|
|
pub fn repeat(c u8, n int) string {
|
2020-02-26 13:22:12 +01:00
|
|
|
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
|
|
|
|
}
|