Xcode-6.2 (6C131e): NSPredicate with "contains ''" never evaluates to true

Originator:segiddins
Number:rdar://20626872 Date Originated:20-Apr-2015 05:35 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode-6.2 (6C131e)
Classification:Serious Bug Reproducible:Always
 
Summary:
Trying to evaluate an NSPredicate of the form “contains ‘’” (contains the empty string) never evaluates to true

Steps to Reproduce:
Run the following swift code:
import Foundation

let strings: NSArray = ["Hi", NSNull(), ""]

let predicate: NSPredicate = NSPredicate(format: "self contains ''")!
let filtered = strings.filteredArrayUsingPredicate(predicate)

Expected Results:
filtered == [“Hi”, “”]

Actual Results:
filtered == []

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!