I have a list of dates in a format yyyyMMdd
as long
. I've created dictionary with key yyyyMMdd
and value yyyyMM
(as NSString
). I need to filter that NSDictionary
(by value
) and create a new one form that. How to do that?
REMARK: I suppose that this is duplicate, but I can not figure out how to do that.
EDIT:
I don't understand why my question is marked as duplicate with questions solving my problem is C#?
As I know (my knowledge in objective-C is limited) the syntax is very different. Also I don't know about linq
or lambdas
in objective-C.
There are a number of ways to do this (including the one you consider noobish). Here's one:
Be warned that
-dictionaryWithValuesForKeys:
, when applied to a dictionary, can do something unexpected for keys starting with "@". That's because it's implemented in terms of-valueForKey:
andNSDictionary
's implementation of that method treats such keys specially. Shouldn't matter for the case you described.