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 23:39, 12 September 2022
, 1 year ago→{{header|FutureBasic}}
No edit summary |
|||
Line 653:
<syntaxhighlight lang="futurebasic">include "NSLog.incl"
void local fn
CFCharacterSetRef vowelSet = fn CharacterSetWithCharactersInString( @"aeiou" )
CFMutableCharacterSetRef
fn MutableCharacterSetRemoveCharactersInString(
*vowels = len( fn StringComponentsSeparatedByCharactersInSet( string, vowelSet ) ) - 1
*consonents = len( fn StringComponentsSeparatedByCharactersInSet( string,
end fn
void local fn DoIt
long index, vowels,
CFArrayRef strings = @[@"abcdefghijklmnop345qrstuvwxyz",
Line 669:
for index = 0 to len(strings) - 1
fn
NSLog(@"\"%@\" contains %ld vowels and %ld
next
end fn
Line 679:
{{out}}
<pre>
"abcdefghijklmnop345qrstuvwxyz" contains 5 vowels and 21
"The quick brown fox jumps over the lazy dog" contains 11 vowels and 24
"The answer my friend is blowing in the wind" contains 11 vowels and 24
</pre>
=={{header|Go}}==
|