comparison runtime/doc/eval.txt @ 6870:66ab6ec256d1 v7.4.755

patch 7.4.755 Problem: It is not easy to count the number of characters. Solution: Add the skipcc argument to strchars(). (Hirohito Higashi, Ken Takata)
author Bram Moolenaar <bram@vim.org>
date Thu, 25 Jun 2015 16:09:26 +0200
parents 37828f7503c7
children 29c328f69aaa
comparison
equal deleted inserted replaced
6869:434c7e45274c 6870:66ab6ec256d1
1983 split( {expr} [, {pat} [, {keepempty}]]) 1983 split( {expr} [, {pat} [, {keepempty}]])
1984 List make |List| from {pat} separated {expr} 1984 List make |List| from {pat} separated {expr}
1985 sqrt( {expr}) Float square root of {expr} 1985 sqrt( {expr}) Float square root of {expr}
1986 str2float( {expr}) Float convert String to Float 1986 str2float( {expr}) Float convert String to Float
1987 str2nr( {expr} [, {base}]) Number convert String to Number 1987 str2nr( {expr} [, {base}]) Number convert String to Number
1988 strchars( {expr}) Number character length of the String {expr} 1988 strchars( {expr} [, {skipcc}]) Number character length of the String {expr}
1989 strdisplaywidth( {expr} [, {col}]) Number display length of the String {expr} 1989 strdisplaywidth( {expr} [, {col}]) Number display length of the String {expr}
1990 strftime( {format}[, {time}]) String time in specified format 1990 strftime( {format}[, {time}]) String time in specified format
1991 stridx( {haystack}, {needle}[, {start}]) 1991 stridx( {haystack}, {needle}[, {start}])
1992 Number index of {needle} in {haystack} 1992 Number index of {needle} in {haystack}
1993 string( {expr}) String String representation of {expr} value 1993 string( {expr}) String String representation of {expr} value
5911 Also see |strtrans()|. 5911 Also see |strtrans()|.
5912 5912
5913 *strlen()* 5913 *strlen()*
5914 strlen({expr}) The result is a Number, which is the length of the String 5914 strlen({expr}) The result is a Number, which is the length of the String
5915 {expr} in bytes. 5915 {expr} in bytes.
5916 If you want to count the number of multi-byte characters (not
5917 counting composing characters) use something like this: >
5918
5919 :let len = strlen(substitute(str, ".", "x", "g"))
5920 <
5921 If the argument is a Number it is first converted to a String. 5916 If the argument is a Number it is first converted to a String.
5922 For other types an error is given. 5917 For other types an error is given.
5923 Also see |len()|, |strchars()|, |strdisplaywidth()| and 5918 If you want to count the number of multi-byte characters use
5924 |strwidth()|. 5919 |strchars()|.
5920 Also see |len()|, |strdisplaywidth()| and |strwidth()|.
5925 5921
5926 strpart({src}, {start}[, {len}]) *strpart()* 5922 strpart({src}, {start}[, {len}]) *strpart()*
5927 The result is a String, which is part of {src}, starting from 5923 The result is a String, which is part of {src}, starting from
5928 byte {start}, with the byte length {len}. 5924 byte {start}, with the byte length {len}.
5929 When non-existing bytes are included, this doesn't result in 5925 When non-existing bytes are included, this doesn't result in