[swift-users] Difference between Apple and Linux versions of Swift - CompareOptions

Zhao Xin owenzx at gmail.com
Sun Jul 10 20:43:58 CDT 2016


I think they should be the same when Swift 3 release. You example is just
how API will change from Swift 2 to 3. You can file a bug if you want to
speed up the changing.

Zhaoxin

On Mon, Jul 11, 2016 at 6:13 AM, Jon Hoffman via swift-users <
swift-users at swift.org> wrote:

> 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
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160711/2c0d730f/attachment.html>


More information about the swift-users mailing list