all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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

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.