emacs-devel
[Top][All Lists]
Advanced

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

Re: On removing some obsolete code from subr and core


From: Dmitry Gutov
Subject: Re: On removing some obsolete code from subr and core
Date: Sat, 5 Nov 2016 18:42:38 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Thunderbird/50.0

On 05.11.2016 17:52, Clément Pit--Claudel wrote:

I never understood this one.  The name string-to-int suggests that you'll get 
an error if your string doesn't describe an int.

I'm just guessing, but that probably never happened. stirng-to-number works like this:

ELISP> (string-to-number "abc")
0 (#o0, #x0, ?\C-@)
ELISP> (string-to-number "22.2abc")
22.2

How do you get a proper string-to-int behavior in Emacs Lisp? With (let ((v 
(string-to-number s))) (when (floatp v) (error …)))?

By calling `floor' on the result of string-to-number, I guess.



reply via email to

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