a word from it, can I check it cases insensitively?
code eg:
string = "Hi seed"
if 'seed' in string:
#docode
string = "Hi Seed"
if 'Seed' in string:
#docode
Here the string var is being provided by input and that is done by a human. The person can input anything he needs here like 'Hi seed', 'Hi SeEd'. Is there a good way of checking if Seed, seed, SEEd exists in it without making the string all lowercased or uppercased?
Language: python3 Source: string1 = "seed" string2 = "seed" string3 = "Seed" if "seed" in string1: print("present 1") if "Seed" in string1: print("present 2") if "Seed" in string3: print("present 3") if "sEEd" in string2: print("present 4") Result: present 1 present 3
Обсуждают сегодня