在开发中遇到的判空处理,或者 null
转@""
等操作,之前是通过内联函数放到头文件中去了,时间久了头文件会很庞大,于是新建了一个类,将所有判空整理到类中
#import <Foundation/Foundation.h>
/**
* Tests if an object is an array which is not empty.
*/
BOOL MBIsArrayWithItems(id object);
/**
* Tests if an object is a dic which is not empty.
*/
BOOL MBIsDicWithItems(id object);
/**
* Tests if an object is a string which is not empty.
*/
BOOL MBIsStringWithAnyText(id object);
/**
* [NSNull null], nil, @"" to "".
* NSNumber to NSString.
* true -> @"1" | false -> @"0".
*/
//空转 @"" number类型转NSString类型
NSString* MBNonEmptyString(id obj);
/**
* [NSNull null], nil, @"" to "-".
* NSNumber to NSString.
* true -> @"1" | false -> @"0".
*/
//空转 @"-" number类型转NSString类型
NSString* MBNonEmptyString_(id obj);
/**
* 汉字转UTF8
*/
NSString* MBEncodingWithAllowedCharactersString(id obj);
BOOL MBJudgeVersionStringForNeedUpdate(NSString* clientVer, NSString* serviceVer);//判断本地版本和服务版本的大小,返回是否需要更新