Count how many vowels and consonants occur in a string
Count how many vowels and consonants occur in a string is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
- Task
- Check how many vowels and consonants occur in a string
Ring
<lang ring> load "stdlib.ring" see "working..." + nl str = '"' + "Forever Ring Programming Language" + '"' vowel = 0 cons =0
for n = 1 to len(str)
if isvowel(str[n]) = 1 vowel += 1 else not isvowel(str[n]) and ascii(str[n]) > 64 and ascii(str[n]) < 123 cons += 1 ok
next
see "Input string = " + str + nl see "In string occur " + vowel + " vowels" + nl see "In string occur " + cons + " consonants" + nl see "done..." + nl </lang>
- Output:
working... Input string = "Forever Ring Programming Language" In string occur 11 vowels In string occur 24 consonants done...