IOS 周几转化数字

NSString *weekStr = @"周二";

NSInteger  weekday = [self passday:weekStr];

-(NSInteger)passday:(NSInteger)day andWeekDay:(NSString *)weekday{

if([weekday isEqualToString:@"周日"]) {

day= 7;

}  else if([weekday isEqualToString:@"周六"]) {

day= 6;

} else if([weekday isEqualToString:@"周五"]) {

day= 5;

} else if([weekday isEqualToString:@"周四"]) {

day= 4;

}  else if([weekday isEqualToString:@"周三"]) {

day= 3;

}  else if([weekday isEqualToString:@"周二"]) {

day= 2;

}  else if([weekday isEqualToString:@"周一"]) {

day= 1;

}

return day;

}

上一篇:加载驱动三种execute


下一篇:Caching和Purgeable Memory (译)