我需要将 NSString 传递并捕获到 int 返回方法,如何通过传递 NSString 来调用它,以及在方法中如何捕获该 NSString?
- (IBAction)lower:(id)sender{
NSString *finalcard = [self getCard];
int *rank = 0; // [self getRank] < also how to pass the finalcard NSString to it?
}
- (NSString *)getCard{
NSString *result = nil;
return result;
}
- (int *)getRank{
//if(passedString == @"randomcard"){return 1}else{ < how to catch the passedString?
return 0;
//}
}
在 java 中,传递看起来像class.getRank("string");
并且捕获它会在
static int getRank(String passedString){