Mercurial > vim
diff src/testdir/test55.in @ 5747:ddc3f32a4b21 v7.4.218
updated for version 7.4.218
Problem: It's not easy to remove duplicates from a list.
Solution: Add the uniq() function. (LCD)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Tue, 25 Mar 2014 18:24:23 +0100 |
parents | b43363a7b4c7 |
children | adc4a84f72eb |
line wrap: on
line diff
--- a/src/testdir/test55.in +++ b/src/testdir/test55.in @@ -323,13 +323,15 @@ let l = [0, 1, 2, 3] : $put ='caught ' . v:exception :endtry :" -:" reverse() and sort() -:let l = ['-0', 'A11', 2, 'xaaa', 4, 'foo', 'foo6', [0, 1, 2], 'x8'] +:" reverse(), sort(), uniq() +:let l = ['-0', 'A11', 2, 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2], 'x8', [0, 1, 2], 1.5] +:$put =string(uniq(copy(l))) :$put =string(reverse(l)) :$put =string(reverse(reverse(l))) :$put =string(sort(l)) :$put =string(reverse(sort(l))) :$put =string(sort(reverse(sort(l)))) +:$put =string(uniq(sort(l))) :" :" splitting a string to a List :$put =string(split(' aa bb '))