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

Tony Parker anthony.parker at apple.com
Tue Jul 12 17:12:25 CDT 2016


Feel free to file issues for us at bugs.swift.org <http://bugs.swift.org/> when you find these kinds of things. Since we have two different source code bases for these APIs, we need to find and fix these kinds of mismatches. This year has had a lot of renaming, so hopefully once we get them all done we should be good to go in the future.

- Tony

> On Jul 10, 2016, at 6:50 PM, Jon Hoffman via swift-users <swift-users at swift.org> 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 <mailto: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 <mailto: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 <mailto:swift-users at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-users <https://lists.swift.org/mailman/listinfo/swift-users>
>> 
> 
> _______________________________________________
> 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/20160712/8d0f0ea5/attachment.html>


More information about the swift-users mailing list