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

builtin: add string.len_utf8() method (#14208)

This commit is contained in:
StunxFS
2022-04-29 03:23:57 -04:00
committed by GitHub
parent 8b798acadd
commit 995485c649
4 changed files with 33 additions and 12 deletions

View File

@ -24,6 +24,14 @@ fn test_add() {
assert a.ends_with('3')
}
fn test_len_utf8() {
assert 'Vlang'.len_utf8() == 5
assert 'María'.len_utf8() == 5
assert ''.len_utf8() == 2
assert 'Слово'.len_utf8() == 5
assert 'Λέξη'.len_utf8() == 4
}
fn test_ends_with() {
a := 'browser.v'
assert a.ends_with('.v')