diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v index 02061b7d0a..b756a61321 100644 --- a/vlib/builtin/string.v +++ b/vlib/builtin/string.v @@ -1015,9 +1015,11 @@ pub fn (s string) repeat(count int) string { if count <= 1 { return s } - ret := malloc(s.len * count + 1) - for _ in 0..count { - C.strcat(ret, s.str) + mut ret := malloc(s.len * count + 1) + for i in 0..count { + for j in 0..s.len { + ret[i*s.len + j] = s[j] + } } return string(ret) }