objective c - Comparing a RLMArray with NSString -
is there way compare rlmarray nsstring?
i want compare textfield.text stored usernames of rlmarray.
thanks help! :)
update:
-(void)checkuser { rlmarray<user *> *userobjects; rlmresults *matches = [userobjects objectswhere:@"name contains %@", _username]; if (matches) { nslog(@"yes"); } else { nslog(@"no"); } }
if you've got rlmarray of user objects (since nsstrings can't directly saved rlmarray), , wish see if of them match nsstring value of uitextfield, should able nspredicate query:
@interface user @property nsstring *username; @end nsstring *textfieldstring = textfield.text; rlmarray<user *> *userobjects = .../ rlmresults *matches = [userobjects objectswhere:@"username contains '%@'", textfieldstring]; for more info on nspredicate filtering, realm maintains list of syntax can use: https://realm.io/news/nspredicate-cheatsheet/
good luck!
Comments
Post a Comment