help-gnu-emacs
[Top][All Lists]
Advanced

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

string to digits only (was: Re: `string-to-number' 0 (was: Re: count mat


From: Emanuel Berg
Subject: string to digits only (was: Re: `string-to-number' 0 (was: Re: count matches in string, not region?))
Date: Wed, 26 Feb 2020 07:13:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

> [...] it reads the curly brackets as well! OK,
> question two, how do you drop everything from
> a string that isn't an integer?

This is perhaps a good way:

  (string-to-number (replace-regexp-in-string "[^0-9]" "" 
"{978-1-61262-294-1}")) ; 9781612622941

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

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