I would like to generate a list of words form a given string where each listed word contains at least an upper case letter.
Having a string like this one:
let str: String = "Apple watchOS 3 USA release date and feature rumours."
I would like to get an array like this:
var list: [String] = ["Apple", "watchOS", "USA"]
What is the best way to do this?
var list = str.componentsSeparatedByString(" ").filter{ $0.lowercaseString != $0 }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With