1fullstring = "StackAbuse"
2substring = "tack"
3
4if fullstring.find(substring) != -1:
5 print "Found!"
6else:
7 print "Not found!"
8
1>>> str = "Messi is the best soccer player"
2>>> "soccer" in str
3True
4>>> "football" in str
5False
1def find_string(string,sub_string):
2 return string.find(sub_string)
3#.find() also accounts for multiple occurence of the substring in the given string
1>>> string = "Hello World"
2>>> # Check Sub-String in String
3>>> "World" in string
4True
5>>> # Check Sub-String not in String
6>>> "World" not in string
7False
1def is_value_in_string(value: str, the_string: str):
2 return value in the_string.lower()
1str = '£35,000 per year'
2# check for '£' character in the string
3'£' not in str
4# >> False
5'£' in str
6# >> True