wes d2a2ba9e15 first commit | há 4 anos atrás | |
---|---|---|
.. | ||
README.md | há 4 anos atrás | |
code.cpp | há 4 anos atrás | |
unitTest.cpp | há 4 anos atrás |
by Matt tags: strings, regex, loops
Write a function that returns the first n vowels of a string. Examples firstNVowels("sharpening skills", 3) ➞ "aei" firstNVowels("major league", 5) ➞ "aoeau" firstNVowels("hostess", 5) ➞ "invalid" Notes Return "invalid" if the n exceeds the number of vowels in a string. Vowels are: a, e, i, o, u
Write a function that returns the first n
vowels of a string.
firstNVowels("sharpening skills", 3) ➞ "aei"
firstNVowels("major league", 5) ➞ "aoeau"
firstNVowels("hostess", 5) ➞ "invalid"
"invalid"
if the n
exceeds the number of vowels in a string.