summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-03-14 19:02:09 +0100
committerBram Moolenaar <Bram@vim.org>2021-03-14 19:02:09 +0100
commit70ce8a1561c5396e4c4381f76a005cbb97646f80 (patch)
treeed4c9ae3c5e62d9f2880fb01c267ada1df76bff0 /runtime
parent0289a093a4d65c6280a3be118d1d3696d1aa74da (diff)
patch 8.2.2606: strchars() defaults to counting composing charactersv8.2.2606
Problem: strchars() defaults to counting composing characters. Solution: Add strcharlen() which ignores composing characters.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt19
-rw-r--r--runtime/doc/usr_41.txt3
2 files changed, 20 insertions, 2 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 92f020689e..3e5c6ee44b 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2923,10 +2923,11 @@ str2list({expr} [, {utf8}]) List convert each character of {expr} to
ASCII/UTF8 value
str2nr({expr} [, {base} [, {quoted}]])
Number convert String to Number
+strcharlen({expr}) Number character length of the String {expr}
strcharpart({str}, {start} [, {len}])
String {len} characters of {str} at
character {start}
-strchars({expr} [, {skipcc}]) Number character length of the String {expr}
+strchars({expr} [, {skipcc}]) Number character count of the String {expr}
strdisplaywidth({expr} [, {col}]) Number display length of the String {expr}
strftime({format} [, {time}]) String format time with a specified format
strgetchar({str}, {index}) Number get char {index} from {str}
@@ -10276,6 +10277,19 @@ str2nr({expr} [, {base} [, {quoted}]]) *str2nr()*
Can also be used as a |method|: >
GetText()->str2nr()
+
+strcharlen({expr}) *strcharlen()*
+ The result is a Number, which is the number of characters
+ in String {expr}. Composing characters are ignored.
+ |strchars()| can count the number of characters, counting
+ composing characters separately.
+
+ Also see |strlen()|, |strdisplaywidth()| and |strwidth()|.
+
+ Can also be used as a |method|: >
+ GetText()->strcharlen()
+
+
strcharpart({src}, {start} [, {len}]) *strcharpart()*
Like |strpart()| but using character index and length instead
of byte index and length. Composing characters are counted
@@ -10288,12 +10302,15 @@ strcharpart({src}, {start} [, {len}]) *strcharpart()*
Can also be used as a |method|: >
GetText()->strcharpart(5)
+
strchars({expr} [, {skipcc}]) *strchars()*
The result is a Number, which is the number of characters
in String {expr}.
When {skipcc} is omitted or zero, composing characters are
counted separately.
When {skipcc} set to 1, Composing characters are ignored.
+ |strcharlen()| does the same.
+
Also see |strlen()|, |strdisplaywidth()| and |strwidth()|.
{skipcc} is only available after 7.4.755. For backward
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 8113bef8e5..0d17298fb0 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -611,7 +611,8 @@ String manipulation: *string-functions*
stridx() first index of a short string in a long string
strridx() last index of a short string in a long string
strlen() length of a string in bytes
- strchars() length of a string in characters
+ strcharlen() length of a string in characters
+ strchars() number of characters in a string
strwidth() size of string when displayed
strdisplaywidth() size of string when displayed, deals with tabs
setcellwidths() set character cell width overrides