bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59531: 29.0.50: An alternative to `string-to-number` which throws an


From: Ramesh Nedunchezian
Subject: bug#59531: 29.0.50: An alternative to `string-to-number` which throws an error (or returns a NIL value) when input is non-parseable as number
Date: Thu, 24 Nov 2022 11:44:43 +0530
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.2

`string-to-number` returns ZERO if the input is not a number.  


This return value is not very helpful.  The choice of a number ZERO as "Not A 
Number" doesn't help one to distinguish between the following two cases

(1) Input was a valid number, and it parses to number zero

(2) Input was NOT a valid number, and it was forcibly reported as ZERO

Consider amending `string-to-number` to throw an error (or return NIL) when the 
input is not parseable as a number, or providing an alternative API to validate 
numbers.  I am trying to parse some fields in an org table, and see if the 
field value is a number or not;

If there is already an alternative to what I am trying to accomplish, I would 
appreciate a recipe.








reply via email to

[Prev in Thread] Current Thread [Next in Thread]