From: "Garreau\, Alexandre" <galex-713@galex-713.eu>
To: help-gnu-emacs@gnu.org
Subject: How to check if a string represent an elisp number (including float), without trailing garbage
Date: Tue, 16 Oct 2018 21:38:23 +0200 [thread overview]
Message-ID: <87k1mhr8b4.fsf@portable.galex-713.eu> (raw)
`number-to-string' ignores garbage so that falsify the output for any
string beginning with a number but not being one, `cl-parse-integer'
raise an error instead of returning nil, and doesn’t support float,
`read' ignores trailing-garbage.
I’d like something that would work depending on elisp reading of
numbers, not regexps or some redundant specification of it, and
preferably cleaner than “(let ((num (string-to-number str))) (and num
(equal (number-to-string num))))” or anything converting back-and-forth.
reply other threads:[~2018-10-16 19:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k1mhr8b4.fsf@portable.galex-713.eu \
--to=galex-713@galex-713.eu \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.