unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to check if a string represent an elisp number (including float),  without trailing garbage
@ 2018-10-16 19:38 Garreau, Alexandre
  0 siblings, 0 replies; only message in thread
From: Garreau, Alexandre @ 2018-10-16 19:38 UTC (permalink / raw)
  To: help-gnu-emacs

`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.



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-16 19:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-16 19:38 How to check if a string represent an elisp number (including float), without trailing garbage Garreau, Alexandre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).