v2 / vlib / builtin / js / utf8.js.v
17 lines · 13 sloc · 287 bytes · 6f5a513d8b421d4c37e265767053e16fb10297ba
Raw
1module builtin
2
3pub fn utf8_str_visible_length(s string) int {
4 // todo: proper implementation
5 res := 0
6 #res.val = s.str.length;
7
8 return res
9}
10
11pub fn utf8_str_len(s string) int {
12 return s.len
13}
14
15pub fn utf8_char_len(b u8) int {
16 return ((0xe5000000 >> ((b >> 3) & 0x1e)) & 3) + 1
17}
18