How do I check if a string contains another string in Swift?
In Objective-C
the code to check for a substring in an NSString
is:
NSString *string = @"hello Swift";
NSRange textRange =[string rangeOfString:@"Swift"];
if(textRange.location != NSNotFound)
{
NSLog(@"exists");
}
But how do I do this in Swift?