aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-10-17 16:01:22 -0400
committerGitHub <noreply@github.com>2020-10-17 16:01:22 -0400
commitbd80671786f59152d5ff19ca5ecd065ace067a51 (patch)
treee74eb3b98a1c879c2b1dd82a53574a39084322e1 /runtime
parentb5cd052037c532e5416919e4077b721ce6ab3a38 (diff)
parent8c9d9fa3044e0c081a2603d3a9d6fa58aa9b6c99 (diff)
downloadrneovim-bd80671786f59152d5ff19ca5ecd065ace067a51.tar.gz
rneovim-bd80671786f59152d5ff19ca5ecd065ace067a51.tar.bz2
rneovim-bd80671786f59152d5ff19ca5ecd065ace067a51.zip
Merge pull request #13101 from skippi/vim-8.2.0868
vim-patch:8.2.0868
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt20
1 files changed, 14 insertions, 6 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 201bb07cd2..392047b565 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2468,7 +2468,8 @@ tolower({expr}) String the String {expr} switched to lowercase
toupper({expr}) String the String {expr} switched to uppercase
tr({src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr}
to chars in {tostr}
-trim({text} [, {mask}]) String trim characters in {mask} from {text}
+trim({text} [, {mask} [, {dir}]])
+ String trim characters in {mask} from {text}
trunc({expr}) Float truncate Float {expr}
type({name}) Number type of variable {name}
undofile({name}) String undo file name for {name}
@@ -9048,21 +9049,28 @@ tr({src}, {fromstr}, {tostr}) *tr()*
echo tr("<blob>", "<>", "{}")
< returns "{blob}"
-trim({text} [, {mask}]) *trim()*
+trim({text} [, {mask} [, {dir}]]) *trim()*
Return {text} as a String where any character in {mask} is
- removed from the beginning and end of {text}.
+ removed from the beginning and/or end of {text}.
If {mask} is not given, {mask} is all characters up to 0x20,
which includes Tab, space, NL and CR, plus the non-breaking
space character 0xa0.
- This code deals with multibyte characters properly.
-
+ The optional {dir} argument specifies where to remove the
+ characters:
+ 0 remove from the beginning and end of {text}
+ 1 remove only at the beginning of {text}
+ 2 remove only at the end of {text}
+ When omitted both ends are trimmed.
+ This function deals with multibyte characters properly.
Examples: >
echo trim(" some text ")
< returns "some text" >
echo trim(" \r\t\t\r RESERVE \t\n\x0B\xA0") . "_TAIL"
< returns "RESERVE_TAIL" >
echo trim("rm<Xrm<>X>rrm", "rm<>")
-< returns "Xrm<>X" (characters in the middle are not removed)
+< returns "Xrm<>X" (characters in the middle are not removed) >
+ echo trim(" vim ", " ", 2)
+< returns " vim"
trunc({expr}) *trunc()*
Return the largest integral value with magnitude less than or