1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

builtin: add 0 terminators for strings returned by .to_lower, .to_upper, utf32_to_str_no_malloc/2

This commit is contained in:
Delyan Angelov
2021-03-14 18:21:45 +02:00
parent b6d089b605
commit d65ad68e77
4 changed files with 17 additions and 14 deletions

View File

@ -877,6 +877,7 @@ pub fn (s string) to_lower() string {
for i in 0 .. s.len {
b[i] = byte(C.tolower(s.str[i]))
}
b[s.len] = 0
return tos(b, s.len)
}
}
@ -900,6 +901,7 @@ pub fn (s string) to_upper() string {
for i in 0 .. s.len {
b[i] = byte(C.toupper(s.str[i]))
}
b[s.len] = 0
return tos(b, s.len)
}
}