[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to read an integer from the minibuffer
From: |
tomas |
Subject: |
Re: How to read an integer from the minibuffer |
Date: |
Fri, 12 Nov 2021 21:24:25 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri, Nov 12, 2021 at 11:02:10PM +0300, Jean Louis wrote:
> Improved check for number:
>
> (defun string-is-number-p (s)
> "Return number only if string is actual number, otherwise NIL."
> (let* ((s (string-trim s)))
> (cond ((seq-empty-p s) nil)
> ((string-match "[^0123456789\\.-]" s) nil)
> ((string-match "-" s 1) nil)
> ((numberp (string-to-number s)) (string-to-number s)))))
Why not simply numberp?
(and (numberp s) (string-to-number s))
Cheers
- t
signature.asc
Description: Digital signature
- Re: How to read an integer from the minibuffer, (continued)
- Re: How to read an integer from the minibuffer, Gregory Heytings, 2021/11/11
- Re: How to read an integer from the minibuffer, Emanuel Berg, 2021/11/11
- Re: How to read an integer from the minibuffer, Jean Louis, 2021/11/12
- Re: How to read an integer from the minibuffer, Emanuel Berg, 2021/11/12
- Re: How to read an integer from the minibuffer, Jean Louis, 2021/11/12
- Re: How to read an integer from the minibuffer, Emanuel Berg, 2021/11/12
- Re: How to read an integer from the minibuffer, Jean Louis, 2021/11/13
- Re: How to read an integer from the minibuffer, Emanuel Berg, 2021/11/16
- Re: How to read an integer from the minibuffer, Jean Louis, 2021/11/12
- Re: How to read an integer from the minibuffer, Jean Louis, 2021/11/12
- Re: How to read an integer from the minibuffer,
tomas <=
- Re: How to read an integer from the minibuffer, Emanuel Berg, 2021/11/12
- Re: How to read an integer from the minibuffer, tomas, 2021/11/12
- Re: How to read an integer from the minibuffer, Emanuel Berg, 2021/11/12
- Re: How to read an integer from the minibuffer, Jean Louis, 2021/11/13
- Re: How to read an integer from the minibuffer, tomas, 2021/11/13
- Re: How to read an integer from the minibuffer, Emanuel Berg, 2021/11/16
- Re: How to read an integer from the minibuffer, Jean Louis, 2021/11/13
- Re: How to read an integer from the minibuffer, tomas, 2021/11/13
- Re: How to read an integer from the minibuffer, Jean Louis, 2021/11/13
- Re: How to read an integer from the minibuffer, Emanuel Berg, 2021/11/16