I want to check if a list of string is contained in another string but ignoring the case
For example:
Input: 'Hello World', ['he', 'o w']
Output: [True, True]
Input: 'Hello World', ['he', 'wol']
Output: [True, False]
I can write something like:
output =[]
for keyword in keywordlist:
if keyword.lower() in string.lower():
output.append(True)
else:
output.append(False)
But the issues with this are:
- the time complexity
- using lower()
I have found this question on stack overflow which is similar Check if multiple strings exist in another string
But it doesn’t work for ignore case.
Is there an efficient way to do this?