From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.help Subject: Re: How to count the number of occurrences of a character in a string? Date: 12 Oct 2015 23:35:26 GMT Message-ID: References: NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1444693242 19785 80.91.229.3 (12 Oct 2015 23:40:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 12 Oct 2015 23:40:42 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 13 01:40:25 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Zlmhc-0002Xc-KU for geh-help-gnu-emacs@m.gmane.org; Tue, 13 Oct 2015 01:40:24 +0200 Original-Received: from localhost ([::1]:59338 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zlmhc-0002xT-6z for geh-help-gnu-emacs@m.gmane.org; Mon, 12 Oct 2015 19:40:24 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 23 Original-X-Trace: individual.net KYPv3pTWV2wWqrvLdNeaPgKjeLL+ImWuJXCVb0MC3O2EG0vEqb Cancel-Lock: sha1:M67PkkQYvL2liBmi6h7k9fpofh4= Mail-Copies-To: nobody X-Editor: Emacs of course! User-Agent: slrn/1.0.1 (Linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:215315 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:107599 Archived-At: Marcin Borkowski wrote: > the subject line says it all. Is there any built-in Elisp function to > do that? Not that I know of. > Should I just use cl-count? That's one option, if you don't mind depending on cl. Alternatively, split-string may be of help: (length (split-string "abcbdbeb" "[^b]" t)) ==> 4 (#o4, #x4, ?\C-d) But that's rather opaque, so you might want to add a comment to tell your future self what you're doing here... -- Joost Kremers joostkremers@fastmail.fm Selbst in die Unterwelt dringt durch Spalten Licht EN:SiS(9)