diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v index 47a3aa532e..1d17535e3e 100644 --- a/vlib/builtin/string.v +++ b/vlib/builtin/string.v @@ -592,6 +592,9 @@ pub fn (s string) substr(start int, end int) string { } } len := end - start + if len == s.len { + return s.clone() + } mut res := string{ str: malloc(len + 1) len: len