在Objective-C代码中检查一个子字符串NSString是:
NSString *string = @"hello Swift";
NSRange textRange =[string rangeOfString:@"Swift"];
if(textRange.location != NSNotFound)
{
NSLog(@"exists");
}
但是我如何在Swift中做到这一点?
相似问题