[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `string-to-number' 0
From: |
Emanuel Berg |
Subject: |
Re: `string-to-number' 0 |
Date: |
Wed, 26 Feb 2020 09:44:34 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
VanL wrote:
>> (string-to-number "a") ; 0
>> (string-to-number "0") ; 0
>> (string-to-number "1") ; 1
>>
>> From the docstring: "Return 0 if STRING
>> cannot be parsed as an integer or floating
>> point number."
>
> (string-to-number "<f1>") ; 60
I get two big 0s:
(string-to-number "a") ; 0
(string-to-number "<f1>") ; 0
The docstring also says "Parse STRING as
a decimal number and return the number."
... but isn't 0 a decimal number?
But come to think of it, it actually DOES work
for 0!
(string-to-number "0") ; 0
Its just one can't tell that from the bogus
inputs and their outputs, which are 0 as well.
One can just verify the input, I guess.
Meta: I got this message as a mail, and it
seems it didn't show up in <gmane.emacs.help>.
So I suppose I reply to it as a mail as well,
and that defaults to To: header to the previous
poster, and Cc: header to
<help-gnu-emacs@gnu.org>. Keep it uptime. Atem.
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal