此方法只需传入字段,会以YES/NO的状态反馈。很严谨的判定方式
//判断是否为空
- (BOOL) isBlankString:(NSString *)string {
if (string == nil || string == NULL) {
return YES;
}
if ([string isKindOfClass:[NSNull class]]) {
return YES;
}
if ([[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length]==0) {
return YES;
}
return NO;
}
//字符串追加相同的字段
-(NSString*)padRight:(int)count {
NSMutableString * str = [[NSMutableString alloc] init];
for(inti=0; i
[strappendString:@"*"];
}
returnstr;
}
转载自:Jaycee麦子 https://www.cnblogs.com/rglmuselily/p/6074502.html