Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func numberOfVowels(in string: String) -> String {
- var count = 0
- for vowels in string.lowercased() {
- switch vowels {
- case "a", "e", "i", "o", "u":
- print(vowels)
- count += 1
- default:
- break
- }
- }
- return "There are \(count) vowels in \"\(string)\""
- }
- numberOfVowels(in: "Hello World")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement