2021-09-03 11:16:07 +02:00
|
|
|
module builtin
|
|
|
|
|
|
|
|
pub fn utf8_str_visible_length(s string) int {
|
|
|
|
// todo: proper implementation
|
|
|
|
res := 0
|
|
|
|
#res.val = s.str.length;
|
|
|
|
|
|
|
|
return res
|
|
|
|
}
|
2021-10-06 09:43:49 +02:00
|
|
|
|
|
|
|
pub fn utf8_str_len(s string) int {
|
|
|
|
return s.len
|
|
|
|
}
|
2021-12-03 11:25:36 +01:00
|
|
|
|
|
|
|
pub fn utf8_char_len(b byte) int {
|
|
|
|
return ((0xe5000000 >> ((b >> 3) & 0x1e)) & 3) + 1
|
|
|
|
}
|