From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Emanuel Berg via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: `string-to-number' 0 (was: Re: count matches in string, not region?) Date: Wed, 26 Feb 2020 06:04:08 +0100 Message-ID: <871rqigcs7.fsf_-_@ebih.ebihd> References: <87a756gedt.fsf@ebih.ebihd> <875zfugdip.fsf@ebih.ebihd> Reply-To: Emanuel Berg Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="77362"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) To: help-gnu-emacs@gnu.org Cancel-Lock: sha1:i18EEggeKBvfpjKcvqQwWlD6mRc= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 26 06:04:45 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j6osH-000K24-6J for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 26 Feb 2020 06:04:45 +0100 Original-Received: from localhost ([::1]:38180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6osG-0005i1-8v for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 26 Feb 2020 00:04:44 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42438) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6oro-0005hq-Mf for help-gnu-emacs@gnu.org; Wed, 26 Feb 2020 00:04:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6orn-0000dG-IR for help-gnu-emacs@gnu.org; Wed, 26 Feb 2020 00:04:16 -0500 Original-Received: from ciao.gmane.io ([159.69.161.202]:44424) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6orn-0000Zw-Bc for help-gnu-emacs@gnu.org; Wed, 26 Feb 2020 00:04:15 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1j6orl-000JU2-Uw for help-gnu-emacs@gnu.org; Wed, 26 Feb 2020 06:04:13 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Mail-Copies-To: never X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 159.69.161.202 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:122472 Archived-At: >> This [last] I wrote a couple of nights ago, >> it is part of my ISBN stuff [1] that will >> soon be a MELPA package, God willing. >> But more on that if and when it happens... > > Wait, that stuff is broke! OK, I'll fix it... > But please respond to the original question > anyway :) Ah, its `thing-at-point', with Biblatex entries, e.g. ;; @book{russian-arms-transfers-to-east, ;; author = {Alexander Sergounin}, ;; isbn = {0-19-829576-6}, ;; publisher = {Oxford}, ;; title = {Russian Arms Transfers to East Asia in the 1990s}, ;; year = 1999 ;; } ;; ;; @book{baa-lo-4, ;; author = {Yukito Kishiro}, ;; isbn = {978-1-61262-294-1}, ;; publisher = {Kodansha}, ;; title = {Battle Angel Alita: The Last Order 4}, ;; year = {2014 (2011)} ;; } it reads the curly brackets as well! OK, question to, how do you drop everything from a string that isn't an integer? Maybe `cl-remove-if-not' but `string-to-number' reports 0 both for string number 0 and strings that are not numbers: (string-to-number "a") ; 0 (string-to-number "0") ; 0 (string-to-number "1") ; 1 >From the docstring: "Return 0 if STRING cannot be parsed as an integer or floating point number." Isn't that a bad idea? How do you know "a" from the legit 0? Also, why return an integer to signal DNC, when the purpose is to get an integer? -- underground experts united http://user.it.uu.se/~embe8573 https://dataswamp.org/~incal