iOS 根据生日计算生肖
-(void)testStr:(NSString *)str{ NSArray *array=@[@"鼠_4",@"牛_5",@"虎_6",@"兔_7",@"龙_8",@"蛇_9",@"马_10",@"羊_11",@"猴_0",@"鸡_1",@"狗_2",@"猪_3"]; for (int i=0; i<array.count; i++) { if ([[array[i] componentsSeparatedByString:@"_"][1] isEqualToString:[NSString stringWithFormat:@"%ld",[str integerValue]%12]]) { NSLog(@"属%@",[array[i] componentsSeparatedByString:@"_"][0]); } } }