At the moment I'm converting my project to Swift 3.
I have a code block like this:
let someString = "asd.asABCDEFG.HI"
let regexp = "^\\w*[.]\\w{2}"
let range = someString.rangeOfString(regexp, options: .RegularExpressionSearch)
let result = someString.substringWithRange(range!)
The rangeOfString
method is gone in Swift 3. Can somebody post an example, how a regexp search can be done. Thanks in advance.
In Swift 3
rangeOfString
is likerange(of:options:)
andsubstringWithRange
is likesubstring(with:)
.