[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to count the number of occurrences of a character in a string?
From: |
Joost Kremers |
Subject: |
Re: How to count the number of occurrences of a character in a string? |
Date: |
12 Oct 2015 23:35:26 GMT |
User-agent: |
slrn/1.0.1 (Linux) |
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)
- Re: How to count the number of occurrences of a character in a string?, (continued)
- Message not available
- Re: How to count the number of occurrences of a character in a string?, Brendan Halpin, 2015/10/13
- Re: How to count the number of occurrences of a character in a string?, Kaushal Modi, 2015/10/13
- Message not available
- Re: How to count the number of occurrences of a character in a string?, Joost Kremers, 2015/10/13
- Re: How to count the number of occurrences of a character in a string?, Oleh Krehel, 2015/10/14
- Re: How to count the number of occurrences of a character in a string?, Eli Zaretskii, 2015/10/14
- Re: How to count the number of occurrences of a character in a string?, Michael Heerdegen, 2015/10/13
- Re: How to count the number of occurrences of a character in a string?, Charles Curley, 2015/10/15
- Re: How to count the number of occurrences of a character in a string?, Noam Postavsky, 2015/10/15
- Re: How to count the number of occurrences of a character in a string?, Kaushal Modi, 2015/10/14
Re: How to count the number of occurrences of a character in a string?, Emanuel Berg, 2015/10/13
Re: How to count the number of occurrences of a character in a string?,
Joost Kremers <=