comparison runtime/doc/eval.txt @ 823:9ab23f1e137f v7.0c12

updated for version 7.0c12
author vimboss
date Fri, 07 Apr 2006 21:40:07 +0000
parents 23f82b5d2814
children 8dd456c1e283
comparison
equal deleted inserted replaced
822:45fad0f590d0 823:9ab23f1e137f
1 *eval.txt* For Vim version 7.0c. Last change: 2006 Apr 04 1 *eval.txt* For Vim version 7.0c. Last change: 2006 Apr 06
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
817 Number. Note that this doesn't recognize multi-byte encodings. 817 Number. Note that this doesn't recognize multi-byte encodings.
818 818
819 Index zero gives the first character. This is like it works in C. Careful: 819 Index zero gives the first character. This is like it works in C. Careful:
820 text column numbers start with one! Example, to get the character under the 820 text column numbers start with one! Example, to get the character under the
821 cursor: > 821 cursor: >
822 :let c = getline(line("."))[col(".") - 1] 822 :let c = getline(".")[col(".") - 1]
823 823
824 If the length of the String is less than the index, the result is an empty 824 If the length of the String is less than the index, the result is an empty
825 String. A negative index always results in an empty string (reason: backwards 825 String. A negative index always results in an empty string (reason: backwards
826 compatibility). Use [-1:] to get the last byte. 826 compatibility). Use [-1:] to get the last byte.
827 827
4560 strpart("abcdefg", -2, 4) == "ab" 4560 strpart("abcdefg", -2, 4) == "ab"
4561 strpart("abcdefg", 5, 4) == "fg" 4561 strpart("abcdefg", 5, 4) == "fg"
4562 strpart("abcdefg", 3) == "defg" 4562 strpart("abcdefg", 3) == "defg"
4563 < Note: To get the first character, {start} must be 0. For 4563 < Note: To get the first character, {start} must be 0. For
4564 example, to get three bytes under and after the cursor: > 4564 example, to get three bytes under and after the cursor: >
4565 strpart(getline(line(".")), col(".") - 1, 3) 4565 strpart(getline("."), col(".") - 1, 3)
4566 < 4566 <
4567 strridx({haystack}, {needle} [, {start}]) *strridx()* 4567 strridx({haystack}, {needle} [, {start}]) *strridx()*
4568 The result is a Number, which gives the byte index in 4568 The result is a Number, which gives the byte index in
4569 {haystack} of the last occurrence of the String {needle}. 4569 {haystack} of the last occurrence of the String {needle}.
4570 When {start} is specified, matches beyond this index are 4570 When {start} is specified, matches beyond this index are