What is the more elegant way to remove all characters after specific character in the String object in Swift?
String
Suppose that I have the following string:
Here is a way to do it:
var str = "str.str" if let dotRange = str.rangeOfString(".") { str.removeRange(dotRange.startIndex..
Update In Swift 3 it is:
var str = "str.str" if let dotRange = str.range(of: ".") { str.removeSubrange(dotRange.lowerBound..