Mercurial > vim
comparison runtime/doc/eval.txt @ 13513:4064f342bea4 v8.0.1630
patch 8.0.1630: trimming white space is not that easy
commit https://github.com/vim/vim/commit/295ac5ab5e840af6051bed5ec9d9acc3c73445de
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Mar 22 23:04:02 2018 +0100
patch 8.0.1630: trimming white space is not that easy
Problem: Trimming white space is not that easy.
Solution: Add the trim() function. (Bukn, closes https://github.com/vim/vim/issues/1280)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 22 Mar 2018 23:15:06 +0100 |
parents | a4a559e08798 |
children | 1fd0f8392946 |
comparison
equal
deleted
inserted
replaced
13512:511cb52e0aa8 | 13513:4064f342bea4 |
---|---|
2461 timer_stopall() none stop all timers | 2461 timer_stopall() none stop all timers |
2462 tolower({expr}) String the String {expr} switched to lowercase | 2462 tolower({expr}) String the String {expr} switched to lowercase |
2463 toupper({expr}) String the String {expr} switched to uppercase | 2463 toupper({expr}) String the String {expr} switched to uppercase |
2464 tr({src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr} | 2464 tr({src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr} |
2465 to chars in {tostr} | 2465 to chars in {tostr} |
2466 trim({text}[, {mask}]) String trim characters in {mask} from {text} | |
2466 trunc({expr}) Float truncate Float {expr} | 2467 trunc({expr}) Float truncate Float {expr} |
2467 type({name}) Number type of variable {name} | 2468 type({name}) Number type of variable {name} |
2468 undofile({name}) String undo file name for {name} | 2469 undofile({name}) String undo file name for {name} |
2469 undotree() List undo file tree | 2470 undotree() List undo file tree |
2470 uniq({list} [, {func} [, {dict}]]) | 2471 uniq({list} [, {func} [, {dict}]]) |
8656 Examples: > | 8657 Examples: > |
8657 echo tr("hello there", "ht", "HT") | 8658 echo tr("hello there", "ht", "HT") |
8658 < returns "Hello THere" > | 8659 < returns "Hello THere" > |
8659 echo tr("<blob>", "<>", "{}") | 8660 echo tr("<blob>", "<>", "{}") |
8660 < returns "{blob}" | 8661 < returns "{blob}" |
8662 | |
8663 trim({text}[, {mask}]) *trim()* | |
8664 Return {text} as a String where any character in {mask} is | |
8665 removed from the beginning and end of {text}. | |
8666 If {mask} is not given, {mask} is all characters up to 0x20, | |
8667 which includes Tab, space, NL and CR, plus the non-breaking | |
8668 space character 0xa0. | |
8669 This code deals with multibyte characters properly. | |
8670 | |
8671 Examples: > | |
8672 echo trim(" \r\t\t\r RESERVE \t \t\n\x0B\x0B")."_TAIL" | |
8673 < returns "RESERVE_TAIL" > | |
8674 echo trim("needrmvRESERVEnnneeedddrrmmmmvv", "ednmrv") | |
8675 < returns "RESERVE" > | |
8676 echo trim("rm<blob1><blob2><any_chars>rrmm<blob1><blob2><blob2>", "rm<blob1><blob2>") | |
8677 < returns "any_chas" | |
8661 | 8678 |
8662 trunc({expr}) *trunc()* | 8679 trunc({expr}) *trunc()* |
8663 Return the largest integral value with magnitude less than or | 8680 Return the largest integral value with magnitude less than or |
8664 equal to {expr} as a |Float| (truncate towards zero). | 8681 equal to {expr} as a |Float| (truncate towards zero). |
8665 {expr} must evaluate to a |Float| or a |Number|. | 8682 {expr} must evaluate to a |Float| or a |Number|. |