判断一个字典中是否存在某个key,有两种方法:
方法一:if ([dictionary allKeys] containsObject: key]){ // cotains key operation;}方法二:if ([dictionary objectForKey: key]){ // objectForKey will return nil if a key doesn't exists. // cotains key operation;}
本文共 365 字,大约阅读时间需要 1 分钟。
判断一个字典中是否存在某个key,有两种方法:
方法一:if ([dictionary allKeys] containsObject: key]){ // cotains key operation;}方法二:if ([dictionary objectForKey: key]){ // objectForKey will return nil if a key doesn't exists. // cotains key operation;}
转载地址:http://mqncl.baihongyu.com/