I want to check, if a string exists in another string, but when I search for the string, I can only get a confirmation, when the string is exactly the same. How can I bypass that?
Asked
Active
Viewed 575 times
0
-
Convert both strings to the same case before checking if it exists. – Barmar Jan 23 '20 at 10:43
-
`string.lower()`? – Guy Jan 23 '20 at 10:43
1 Answers
1
Try this, it checks whether string is contained in string2 (case insensitive) after verifying they are different :
string != string2 and str.lower(string) in str.lower(string2)

EricLavault
- 12,130
- 3
- 23
- 45