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

builtin: add string.split_by_whitespace()

This commit is contained in:
Delyan Angelov
2020-12-29 08:46:46 +02:00
parent b87283e970
commit 84fc9cec4b
2 changed files with 38 additions and 0 deletions

View File

@ -902,3 +902,10 @@ fn test_sorter() {
assert arr[2].s == 'ccc'
assert arr[2].i == 102
}
fn test_split_by_whitespace() {
assert 'a bcde'.split_by_whitespace() == ['a', 'bcde']
assert ' sss \t ssss '.split_by_whitespace() == ['sss', 'ssss']
assert '\n xyz \t abc def'.split_by_whitespace() == ['xyz', 'abc', 'def']
assert ''.split_by_whitespace() == []
}