-(void)testStr:(NSString *)str{ NSArray *[email protected][@"鼠_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]); } } }
时间: 2024-10-12 07:20:58