1
0
forked from aniani/vim

Added strwidth() and strchars() functions.

This commit is contained in:
Bram Moolenaar
2010-07-18 15:31:08 +02:00
parent 9855d6b361
commit 72597a57b5
10 changed files with 99 additions and 42 deletions

View File

@@ -1909,6 +1909,7 @@ split( {expr} [, {pat} [, {keepempty}]])
sqrt( {expr} Float squar root of {expr}
str2float( {expr}) Float convert String to Float
str2nr( {expr} [, {base}]) Number convert String to Number
strchars( {expr}) Number character length of the String {expr}
strftime( {format}[, {time}]) String time in specified format
stridx( {haystack}, {needle}[, {start}])
Number index of {needle} in {haystack}
@@ -1919,6 +1920,7 @@ strpart( {src}, {start}[, {len}])
strridx( {haystack}, {needle} [, {start}])
Number last index of {needle} in {haystack}
strtrans( {expr}) String translate string to make it printable
strwidth( {expr}) Number display cell length of the String {expr}
submatch( {nr}) String specific match in ":substitute"
substitute( {expr}, {pat}, {sub}, {flags})
String all {pat} in {expr} replaced with {sub}
@@ -5362,6 +5364,12 @@ str2nr( {expr} [, {base}]) *str2nr()*
Text after the number is silently ignored.
strchars({expr}) *strchars()*
The result is a Number, which is the number of characters
String {expr} occupies. Composing characters are counted
separately.
Also see |strlen()| and |strwidth()|.
strftime({format} [, {time}]) *strftime()*
The result is a String, which is a formatted date and time, as
specified by the {format} string. The given {time} is used,
@@ -5424,7 +5432,7 @@ strlen({expr}) The result is a Number, which is the length of the String
<
If the argument is a Number it is first converted to a String.
For other types an error is given.
Also see |len()|.
Also see |len()|, |strchars()| and |strwidth()|.
strpart({src}, {start}[, {len}]) *strpart()*
The result is a String, which is part of {src}, starting from
@@ -5467,6 +5475,14 @@ strtrans({expr}) *strtrans()*
< This displays a newline in register a as "^@" instead of
starting a new line.
strwidth({expr}) *strwidth()*
The result is a Number, which is the number of display cells
String {expr} occupies. A Tab character is counted as one
cell (on the screen it depends on the position).
When {expr} contains characters with East Asian Width Class
Ambiguous, this function's return value depends on 'ambiwidth'.
Also see |strlen()| and |strchars()|.
submatch({nr}) *submatch()*
Only for an expression in a |:substitute| command. Returns
the {nr}'th submatch of the matched text. When {nr} is 0

View File

@@ -1193,8 +1193,8 @@ Awaiting updated patches:
Search in 'runtimepath'?
More docs needed about how to use this.
How to get the messages into the .po files?
charlen() Like strlen() but counting characters instead of
bytes.
strchars() Like strlen() and strwidth() but counting characters
instead of bytes.
confirm() add "flags" argument, with 'v' for vertical
layout and 'c' for console dialog. (Haegg)
Flemming Madsen has a patch for the 'c' flag