In Objective-C
the code to check for a substring in an NSString
is:
NSString *string = @\"hello Swift\";
NSRange textRange =[strin
If you want to check that one String contains another Sub-String within it or not you can check it like this too,
var name = String()
name = "John has two apples."
Now, in this particular string if you want to know if it contains fruit name 'apple' or not you can do,
if name.contains("apple")
{
print("Yes , it contains fruit name")
}
else
{
print(it does not contain any fruit name)
}
Hope this works for you.