[swift-users] Difference between Apple and Linux versions of Swift - CompareOptions
Jon Hoffman
hoffman.jon at gmail.com
Sun Jul 10 17:13:08 CDT 2016
With Swift 3.0 Preview 2 for Linux and Xcode Beta 2 for macOS, I see a
difference in the CompareOptions when I use the range(of:option:)
method of the String type. For example, in Xcode I use this code:
if let newMatch = str.range(of: regExFindMatchString, options:
.regularExpression) {
return str.substring(with: newMatch)
} else {
return nil
}
notice the .regularExpression. However in the Linux version I need to
use the .regularExpressionSearch option like this:
if let newMatch = str.range(of:regExFindMatchString, options:
.regularExpressionSearch) {
return str.substring(with: newMatch)
} else {
return nil
}
Is it safe to assume that the version that works with Xcode is going
to be the correct version once Swift 3.0 is released?
Thanks
Jon
More information about the swift-users
mailing list