nspredicate

how to form predicate to get objects from Core Data that contain string elements from Array

霸气de小男生 提交于 2019-12-13 19:58:02
问题 I need to create a predicate to get object from core data, My entity "Form" looks like that: @interface EEForm (CoreDataProperties) @property (nullable, nonatomic, retain) NSDate *date; @property (nullable, nonatomic, retain) NSString *descriptor; @property (nullable, nonatomic, retain) NSString *location; @property (nullable, nonatomic, retain) NSMutableSet<Participants *> *participants; entity "Participants" look like that: @interface Participants (CoreDataProperties) @property (nonatomic,

Is there a java equivalent to NSPredicate?

假装没事ソ 提交于 2019-12-13 16:35:42
问题 I am writing something in java that will try to "autocomplete" what a user is typing. I have used NSPredicate on iPhone apps to do this. It was very easy and worked well. I am hoping that there is something similar in java, but not having much luck finding it. If something does not already exist to do this in java, does anyone have any suggestions on the best approach? I'm thinking of maybe doing something like having a Map with the key being "A", "B", "C", ... and the value being a list of

NSPredicate using RLMResults as an argument

▼魔方 西西 提交于 2019-12-13 15:08:08
问题 I am trying to get the difference between two sets of Realm data (and are different objects) by filtering using an NSPredicate, but there is an error that I'm having trouble understanding. My code: RLMResults *topStories = [KFXTopStory allObjects]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"NONE threadId = %@.topStoryId", topStories]; RLMResults *objectsToDelete = [KFXThread objectsWithPredicate:predicate]; Error: *** Terminating app due to uncaught exception 'Invalid

Email Regular expression issue while using special characters [duplicate]

梦想的初衷 提交于 2019-12-13 08:55:16
问题 This question already has answers here : How to validate an email address using a regular expression? (73 answers) Closed 3 years ago . I have created the following regular expression for validating my email - (BOOL)isValidEmail { BOOL stricterFilter = YES; NSString *stricterFilterString = @"[A-Z0-9a-z\\._%+-]+@([A-Za-z0-9-]+\\.)+[A-Za-z]{2,4}"; NSString *laxString = @".+@([A-Za-z0-9]+\\.)+[A-Za-z]{2}[A-Za-z]*"; NSString *emailRegex = stricterFilter ? stricterFilterString : laxString;

Search Bar Swift 3 - Can't use in/contains operator with collection

雨燕双飞 提交于 2019-12-13 08:45:01
问题 I am implementing a search bar into my project but I am being presented with the below error. reason: 'Can't use in/contains operator with collection wellpleased.attendees.UserData(firstname: "Ben", lastname: "Delonge", fullname: "Ben Delonge", company: "AllStar.com", jobtitle: "Business Development Manager", image: "6.jpg") (not a collection)' I have done plenty of searching around the NSPredicate but cannot seem to prevent this crashing. I am using the code below, any assistance resolving

NSPredicate : CoreData fetchRequest filtered by Array of dictionaries

随声附和 提交于 2019-12-13 07:50:26
问题 Is it possible to create an NSPredicate using an array of dictionaries ? I have a following structure : [{ name: "foo", city:"Paris"},{name:"bar", city:"London"}] An I want to filter my NSFetchRequest by these pairs. (supposing the properties have the same names in CoreData) When passing an array I can use the keyword IN . But I don't get how make this work with an array of dictionaries. 回答1: I don't think you will be able to use IN , so you need to use a number of OR s. In outline: Iterate

Comparing two arrays with NSPredicate

安稳与你 提交于 2019-12-13 06:14:07
问题 I've two array, one represents a list of full-size images and the other one represents the images' thumbnail. There is a way, using NSPredicate, to check if a full-size image has a thumbnail? The thumb is called img{number}_thumb.jpg and the full-size image is called img{number}.jpg. 回答1: Using Arrays, strings and loop : NSArray *thumbs=@[@"img1_thumb.jpg",@"img2_thumb.jpg",@"img3_thumb.jpg",@"img4_thumb.jpg",@"img5_thumb.jpg",]; NSArray *images=@[@"img1",@"img2",@"img3",@"img41",@"img5"];

DDMathParser: Parsing formulas which contain if statements

☆樱花仙子☆ 提交于 2019-12-13 06:04:51
问题 I have started to implement DDMathParser in my current project and I use this framework to calculate the results of formulas in combination with variables given in a dictionary ( variable substitution ). Would it be possible to use something like if statements in the formulas, e.g. " if ($a > 0) { $b / $c } else {$b * 1000} ? I assume that if statements could be created in a similar way than new functions (as described in the DDMathParser Wiki). If this would be the case, I would be glad if

NSPredicate with Core Data

核能气质少年 提交于 2019-12-13 04:34:07
问题 I've look through apple documentation and SO and I cannot find this simple code. I will accept any down votes I get for such a question, but what is the predicate string that will return a given entity where that entity's property is equivalent to a given string. I have company and product entities. At the moment, they are simple. Company has name and some other attributes. Product has manufacturer and some other attributes. I want to do a fetch for all products where the products

Writing a simple NSpredicate - Logic Issue

为君一笑 提交于 2019-12-13 04:23:39
问题 I have a Person object. and this person object has the following attributes; Name StartDate EndDate I am saving this Person objects to an array . This array might contain more than 100 person objects. The following is an example of person objects in that array; John, Tue Feb 22, Thr Mar 30 Jack, Wed Mar 09, Fri Apr 21 Jack, Thu Mar 19, Fri Dec 20 Jack, Tue Jan 08, Fri Apr 26 etc.. Now i need to will supply a date, say for example Wed 29 Mar , and i need to check if it's in the range of