Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 30th, 2012  |  syntax: None  |  size: 0.40 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Evaluate/compare NSString with wildcards?
  2. NSString *filePath = @"file://Users/test/Desktop/file.txt";
  3. NSString *matchCriteria = @"file://*/file.*";
  4.        
  5. NSString *filePath = @"file://Users/test/Desktop/file.txt";
  6. NSString *matchCriteria = @"file://*/file.*";
  7.  
  8. NSPredicate *pred = [NSPredicate predicateWithFormat:@"self LIKE %@", matchCriteria];
  9.  
  10. BOOL filePathMatches = [pred evaluateWithObject:filePath];