Mercurial > vim
diff runtime/doc/eval.txt @ 23594:d3e064f54890 v8.2.2339
patch 8.2.2339: cannot get the type of a value as a string
Commit: https://github.com/vim/vim/commit/a47e05f04a5a5c0369c949157c24d09cbe64ad6a
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jan 12 21:49:00 2021 +0100
patch 8.2.2339: cannot get the type of a value as a string
Problem: Cannot get the type of a value as a string.
Solution: Add typename().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 12 Jan 2021 22:00:06 +0100 |
parents | 510088f8c66f |
children | 7b3317e959e3 |
line wrap: on
line diff
--- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -3016,7 +3016,8 @@ tr({src}, {fromstr}, {tostr}) String tra trim({text} [, {mask} [, {dir}]]) String trim characters in {mask} from {text} trunc({expr}) Float truncate Float {expr} -type({name}) Number type of variable {name} +type({expr}) Number type of value {expr} +typename({expr}) String representation of the type of {expr} undofile({name}) String undo file name for {name} undotree() List undo file tree uniq({list} [, {func} [, {dict}]]) @@ -11129,6 +11130,14 @@ type({expr}) The result is a Number repr < Can also be used as a |method|: > mylist->type() + +typename({expr}) *typename()* + Return a string representation of the type of {expr}. + Example: > + echo typename([1, 2, 3]) + list<number> + + undofile({name}) *undofile()* Return the name of the undo file that would be used for a file with name {name} when writing. This uses the 'undodir'