Uploaded image for project: 'Swift'
  1. Swift
  2. SR-3688

String.rangeOfCharacter(from:) Produces Incorrect Result on Linux

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Duplicate
    • Component/s: Foundation
    • Labels:
    • Environment:

      macOS: 10.12
      Xcode: 8.2

      Linux: Ubuntu 16.04
      swift-3.0.2-RELEASE

      Description

      import Foundation
      
      let foo = "_"
      
      let bar = CharacterSet.alphanumerics.union(CharacterSet(charactersIn: foo))
      
      let baz = foo.rangeOfCharacter(from: bar.inverted)
      
      let qux = (baz == nil)
      
      print("baz: \(baz as Any)")
      
      // On macOS this prints `true` and on Linux this prints `false`.
      print("qux: \(qux)")
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              aamctustwo Aaron McTavish
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: