@@ -1187,7 +1187,8 @@ byte under the cursor: >
11871187
11881188In Vim9 script:
11891189If expr8 is a String this results in a String that contains the expr1'th
1190- single character from expr8. To use byte indexes use |strpart()|.
1190+ single character (including any composing characters) from expr8. To use byte
1191+ indexes use |strpart()|.
11911192
11921193Index zero gives the first byte or character. Careful: text column numbers
11931194start with one!
@@ -1217,8 +1218,9 @@ In legacy Vim script the indexes are byte indexes. This doesn't recognize
12171218multibyte encodings, see |byteidx()| for computing the indexes. If expr8 is
12181219a Number it is first converted to a String.
12191220
1220- In Vim9 script the indexes are character indexes. To use byte indexes use
1221- |strpart()|.
1221+ In Vim9 script the indexes are character indexes and include composing
1222+ characters. To use byte indexes use |strpart()|. To use character indexes
1223+ without including composing characters use |strcharpart()|.
12221224
12231225The item at index expr1b is included, it is inclusive. For an exclusive index
12241226use the |slice()| function.
@@ -2924,7 +2926,7 @@ str2list({expr} [, {utf8}]) List convert each character of {expr} to
29242926str2nr({expr} [, {base} [, {quoted}]])
29252927 Number convert String to Number
29262928strcharlen({expr}) Number character length of the String {expr}
2927- strcharpart({str}, {start} [, {len}])
2929+ strcharpart({str}, {start} [, {len} [, {skipcc}] ])
29282930 String {len} characters of {str} at
29292931 character {start}
29302932strchars({expr} [, {skipcc}]) Number character count of the String {expr}
@@ -9919,7 +9921,7 @@ slice({expr}, {start} [, {end}]) *slice()*
99199921 Similar to using a |slice| "expr[start : end]", but "end" is
99209922 used exclusive. And for a string the indexes are used as
99219923 character indexes instead of byte indexes, like in
9922- |vim9script|.
9924+ |vim9script|. Also, composing characters are not counted.
99239925 When {end} is omitted the slice continues to the last item.
99249926 When {end} is -1 the last item is omitted.
99259927
@@ -10290,12 +10292,16 @@ strcharlen({expr}) *strcharlen()*
1029010292 GetText()->strcharlen()
1029110293
1029210294
10293- strcharpart({src}, {start} [, {len}]) *strcharpart()*
10295+ strcharpart({src}, {start} [, {len} [, {skipcc}]]) *strcharpart()*
1029410296 Like |strpart()| but using character index and length instead
10295- of byte index and length. Composing characters are counted
10296- separately.
10297+ of byte index and length.
10298+ When {skipcc} is omitted or zero, composing characters are
10299+ counted separately.
10300+ When {skipcc} set to 1, Composing characters are ignored,
10301+ similar to |slice()|.
1029710302 When a character index is used where a character does not
10298- exist it is assumed to be one character. For example: >
10303+ exist it is omitted and counted as one character. For
10304+ example: >
1029910305 strcharpart('abc', -1, 2)
1030010306< results in 'a'.
1030110307
@@ -10309,7 +10315,7 @@ strchars({expr} [, {skipcc}]) *strchars()*
1030910315 When {skipcc} is omitted or zero, composing characters are
1031010316 counted separately.
1031110317 When {skipcc} set to 1, Composing characters are ignored.
10312- |strcharlen()| does the same .
10318+ |strcharlen()| always does this .
1031310319
1031410320 Also see |strlen()|, |strdisplaywidth()| and |strwidth()|.
1031510321
0 commit comments