NewSafeObject.h 792 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // NewSafeObject.h
  3. // MingMen
  4. //
  5. // Created by 罗云飞 on 2017/3/9.
  6. // Copyright © 2017年 罗云飞. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. @interface NSArray (SafeObjectAtIndex)
  10. //取数组下标值
  11. - (id) safeObjectAtIndex : (NSUInteger) index;
  12. //判断数组或者字典大小
  13. - (NSInteger)safeCount;
  14. @end
  15. @interface NSDictionary (SafeObjectForKey)
  16. //根据Key取Value
  17. - (id) safeObjectForKey : (NSString *) key;
  18. @end
  19. @interface NSMutableDictionary (SafeObjectForKey)
  20. //字典数据存储 判断Key Value是否为空
  21. - (void) safeSetObject:(id)value forKey:(NSString*)key;
  22. //字符串转UTF8编码
  23. - (void) safeUTF8SetObject:(id)value forKey:(NSString*)key;
  24. //数组转JSON字符串
  25. - (void) safeJSONSetObject:(id)value forKey:(NSString*)key;
  26. @end