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

Zhao Xin owenzx at gmail.com
Sun Jul 10 22:10:40 CDT 2016


You are right, the shorter one will exist in the final release. Always the
shorter ones.

Zhaoxin

On Mon, Jul 11, 2016 at 9:50 AM, Jon Hoffman <hoffman.jon at gmail.com> wrote:

> Thank you for the reply.  I am pretty sure that you are correct about them
> being the same when Swift 3 is released.  I am more concerned about which
> API will be the correct one when Swift 3 is officially released.  My
> assumption is the Xcode version will be the final one but just wanted to
> verify it.
> Thanks
>
> Jon
>
> On Jul 10, 2016, at 9:43 PM, Zhao Xin <owenzx at gmail.com> wrote:
>
> 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/a008accd/attachment.html>


More information about the swift-users mailing list