2019-07-10 09:07:04 +02:00
|
|
|
fn test_utf8_char_len() {
|
2020-03-26 17:14:24 +01:00
|
|
|
assert utf8_char_len(`a`) == 1
|
|
|
|
println(utf8_char_len(`a`))
|
|
|
|
s := 'п'
|
|
|
|
assert utf8_char_len(s[0]) == 2
|
2019-07-10 09:07:04 +02:00
|
|
|
}
|
2021-01-01 10:06:09 +01:00
|
|
|
|
|
|
|
fn test_utf8_wide_char() {
|
|
|
|
r := `🌎`
|
|
|
|
val := r.str().str
|
|
|
|
unsafe {
|
|
|
|
assert '${val[0]:x}${val[1]:x}${val[2]:x}${val[3]:x}' == 'f09f8c8e'
|
|
|
|
}
|
|
|
|
}
|