Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func numberOfVowels(in string: String) -> Int {
- var count = 0
- for char in string.lowercased() {
- switch char {
- case "a", "e", "i", "o", "u":
- count += 1
- default:
- ()
- }
- }
- return count
- }
- numberOfVowels(in: "The quick brown fox jumps over the lazy dog")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement