comparison runtime/doc/eval.txt @ 2338:da6ec32d8d8f vim73

Added strwidth() and strchars() functions.
author Bram Moolenaar <bram@vim.org>
date Sun, 18 Jul 2010 15:31:08 +0200
parents a0f87fc19d1d
children 01e4b4d37842
comparison
equal deleted inserted replaced
2337:a0f87fc19d1d 2338:da6ec32d8d8f
1907 split( {expr} [, {pat} [, {keepempty}]]) 1907 split( {expr} [, {pat} [, {keepempty}]])
1908 List make |List| from {pat} separated {expr} 1908 List make |List| from {pat} separated {expr}
1909 sqrt( {expr} Float squar root of {expr} 1909 sqrt( {expr} Float squar root of {expr}
1910 str2float( {expr}) Float convert String to Float 1910 str2float( {expr}) Float convert String to Float
1911 str2nr( {expr} [, {base}]) Number convert String to Number 1911 str2nr( {expr} [, {base}]) Number convert String to Number
1912 strchars( {expr}) Number character length of the String {expr}
1912 strftime( {format}[, {time}]) String time in specified format 1913 strftime( {format}[, {time}]) String time in specified format
1913 stridx( {haystack}, {needle}[, {start}]) 1914 stridx( {haystack}, {needle}[, {start}])
1914 Number index of {needle} in {haystack} 1915 Number index of {needle} in {haystack}
1915 string( {expr}) String String representation of {expr} value 1916 string( {expr}) String String representation of {expr} value
1916 strlen( {expr}) Number length of the String {expr} 1917 strlen( {expr}) Number length of the String {expr}
1917 strpart( {src}, {start}[, {len}]) 1918 strpart( {src}, {start}[, {len}])
1918 String {len} characters of {src} at {start} 1919 String {len} characters of {src} at {start}
1919 strridx( {haystack}, {needle} [, {start}]) 1920 strridx( {haystack}, {needle} [, {start}])
1920 Number last index of {needle} in {haystack} 1921 Number last index of {needle} in {haystack}
1921 strtrans( {expr}) String translate string to make it printable 1922 strtrans( {expr}) String translate string to make it printable
1923 strwidth( {expr}) Number display cell length of the String {expr}
1922 submatch( {nr}) String specific match in ":substitute" 1924 submatch( {nr}) String specific match in ":substitute"
1923 substitute( {expr}, {pat}, {sub}, {flags}) 1925 substitute( {expr}, {pat}, {sub}, {flags})
1924 String all {pat} in {expr} replaced with {sub} 1926 String all {pat} in {expr} replaced with {sub}
1925 synID( {lnum}, {col}, {trans}) Number syntax ID at {lnum} and {col} 1927 synID( {lnum}, {col}, {trans}) Number syntax ID at {lnum} and {col}
1926 synIDattr( {synID}, {what} [, {mode}]) 1928 synIDattr( {synID}, {what} [, {mode}])
5360 When {base} is 16 a leading "0x" or "0X" is ignored. With a 5362 When {base} is 16 a leading "0x" or "0X" is ignored. With a
5361 different base the result will be zero. 5363 different base the result will be zero.
5362 Text after the number is silently ignored. 5364 Text after the number is silently ignored.
5363 5365
5364 5366
5367 strchars({expr}) *strchars()*
5368 The result is a Number, which is the number of characters
5369 String {expr} occupies. Composing characters are counted
5370 separately.
5371 Also see |strlen()| and |strwidth()|.
5372
5365 strftime({format} [, {time}]) *strftime()* 5373 strftime({format} [, {time}]) *strftime()*
5366 The result is a String, which is a formatted date and time, as 5374 The result is a String, which is a formatted date and time, as
5367 specified by the {format} string. The given {time} is used, 5375 specified by the {format} string. The given {time} is used,
5368 or the current time if no time is given. The accepted 5376 or the current time if no time is given. The accepted
5369 {format} depends on your system, thus this is not portable! 5377 {format} depends on your system, thus this is not portable!
5422 5430
5423 :let len = strlen(substitute(str, ".", "x", "g")) 5431 :let len = strlen(substitute(str, ".", "x", "g"))
5424 < 5432 <
5425 If the argument is a Number it is first converted to a String. 5433 If the argument is a Number it is first converted to a String.
5426 For other types an error is given. 5434 For other types an error is given.
5427 Also see |len()|. 5435 Also see |len()|, |strchars()| and |strwidth()|.
5428 5436
5429 strpart({src}, {start}[, {len}]) *strpart()* 5437 strpart({src}, {start}[, {len}]) *strpart()*
5430 The result is a String, which is part of {src}, starting from 5438 The result is a String, which is part of {src}, starting from
5431 byte {start}, with the byte length {len}. 5439 byte {start}, with the byte length {len}.
5432 When non-existing bytes are included, this doesn't result in 5440 When non-existing bytes are included, this doesn't result in
5464 characters translated into printable characters |'isprint'|. 5472 characters translated into printable characters |'isprint'|.
5465 Like they are shown in a window. Example: > 5473 Like they are shown in a window. Example: >
5466 echo strtrans(@a) 5474 echo strtrans(@a)
5467 < This displays a newline in register a as "^@" instead of 5475 < This displays a newline in register a as "^@" instead of
5468 starting a new line. 5476 starting a new line.
5477
5478 strwidth({expr}) *strwidth()*
5479 The result is a Number, which is the number of display cells
5480 String {expr} occupies. A Tab character is counted as one
5481 cell (on the screen it depends on the position).
5482 When {expr} contains characters with East Asian Width Class
5483 Ambiguous, this function's return value depends on 'ambiwidth'.
5484 Also see |strlen()| and |strchars()|.
5469 5485
5470 submatch({nr}) *submatch()* 5486 submatch({nr}) *submatch()*
5471 Only for an expression in a |:substitute| command. Returns 5487 Only for an expression in a |:substitute| command. Returns
5472 the {nr}'th submatch of the matched text. When {nr} is 0 5488 the {nr}'th submatch of the matched text. When {nr} is 0
5473 the whole matched text is returned. 5489 the whole matched text is returned.