From 6617629ad6eceeb77d49633780a7213eeb17a2c9 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Sat, 22 May 2021 19:44:53 +0100 Subject: vim-patch:8.1.2035: recognizing octal numbers is confusing Problem: Recognizing octal numbers is confusing. Solution: Introduce scriptversion 4: do not use octal and allow for single quote inside numbers. https://github.com/vim/vim/commit/60a8de28d11595f4df0419ece8afa7d6accc9fbd :scriptversion is N/A. Cherry-pick Test_readfile_binary() from v8.1.0742. Note that this patch was missing vim_str2nr() changes, and so fails the tests; this was fixed in v8.1.2036. --- runtime/doc/eval.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 211774ad2d..cd449a5d34 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2508,7 +2508,8 @@ stdpath({what}) String/List returns the standard path(s) for {w str2float({expr}) Float convert String to Float str2list({expr} [, {utf8}]) List convert each character of {expr} to ASCII/UTF8 value -str2nr({expr} [, {base}]) Number convert String to Number +str2nr({expr} [, {base} [, {quoted}]]) + Number convert String to Number strchars({expr} [, {skipcc}]) Number character length of the String {expr} strcharpart({str}, {start} [, {len}]) String {len} characters of {str} at @@ -8637,9 +8638,11 @@ str2list({expr} [, {utf8}]) *str2list()* < Can also be used as a |method|: > GetString()->str2list() -str2nr({expr} [, {base}]) *str2nr()* +str2nr({expr} [, {base} [, {quoted}]]) *str2nr()* Convert string {expr} to a number. {base} is the conversion base, it can be 2, 8, 10 or 16. + When {quoted} is present and non-zero then embedded single + quotes are ignored, thus "1'000'000" is a million. When {base} is omitted base 10 is used. This also means that a leading zero doesn't cause octal conversion to be used, as -- cgit