-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path35_List.vim
More file actions
46 lines (35 loc) · 825 Bytes
/
35_List.vim
File metadata and controls
46 lines (35 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
echo ['foo', 3, 'bar']
echo ['foo', [3, 'bar']]
echo [0, [1, 2]][1]
echo [0, [1, 2]][-2]
echo ['a', 'b', 'c', 'd', 'e'][0:2]
echo ['a', 'b', 'c', 'd', 'e'][0:10000]
echo "-----------------"
echo ['a', 'b', 'c', 'd', 'e'][-2:-1]
echo ['a', 'b', 'c', 'd', 'e'][:1]
echo ['a', 'b', 'c', 'd', 'e'][3:]
echo "-----------------"
echo 'abcd'[0:2]
echo "abcd"[1:3]
"Note: there will output empty by next line
echo "abcd"[-1]
echo "abcd"[-1] . "abcd"[-2:]
echo "-----------------"
echo ['a', 'b'] + ['c']
"echo ['a'] * 3
echo "-----------------"
let foo = ['a']
call add(foo, 'b')
echo foo
echo len(foo)
echo get(foo, 0, 'default')
echo get(foo, 100, 'default')
echo index(foo, 'b')
echo index(foo, 'nope')
echo join(foo)
echo join(foo, '---')
echo join([1, 2, 3], '')
call reverse(foo)
echo foo
call reverse(foo)
echo foo