Anonymous user
Count how many vowels and consonants occur in a string: Difference between revisions
Count how many vowels and consonants occur in a string (view source)
Revision as of 08:47, 31 January 2022
, 2 years agono edit summary
Not a robot (talk | contribs) (Add COBOL) |
No edit summary |
||
Line 461:
<pre>If not now, then when? If not us, then who?
10 vowels, 20 consonants.</pre>
=={{header|Common Lisp}}==
<lang lisp>(defun vowel-p (c &optional (vowels "aeiou"))
(and (characterp c) (characterp (find c vowels :test #'char-equal))))
(defun count-vowels (s)
(and (stringp s) (count-if #'vowel-p s)))
(defun count-consonants (s)
(and (stringp s) (- (count-if #'alpha-char-p s) (count-vowels s))))</lang>
=={{header|Cowgol}}==
|