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

vlib: remove ustring usage (#10618)

This commit is contained in:
Daniel Däschle
2021-06-30 21:30:28 +02:00
committed by GitHub
parent 9d02ca51d1
commit 3881e97a40
14 changed files with 86 additions and 80 deletions

View File

@ -73,7 +73,8 @@ pub fn (s string) runes() []rune {
for i := 0; i < s.len; i++ {
char_len := utf8_char_len(unsafe { s.str[i] })
if char_len > 1 {
mut r := unsafe { s[i..i + char_len] }
end := if s.len - 1 >= i + char_len { i + char_len } else { s.len }
mut r := unsafe { s[i..end] }
runes << r.utf32_code()
i += char_len - 1
} else {