Skip to content
Advertisement

Check if multiple strings exist in another string

How can I check if any of the strings in an array exists in another string?

For example:

JavaScript

How can I replace the if a in s: line to get the appropriate result?

Advertisement

Answer

You can use any:

JavaScript

Similarly to check if all the strings from the list are found, use all instead of any.

Advertisement