Match-All-String
Sat 17 May 2025
title: "Match All String" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false
one = "Toronto is nice"
one
'Toronto is nice'
one_array = one.split(" ")
two = "It is nice to be in Toronto"
two_array = two.split(" ")
two_array
['It', 'is', 'nice', 'to', 'be', 'in', 'Toronto']
all(x in two for x in one_array)
True
More:
https://stackoverflow.com/questions/56165622/shortest-way-to-check-wether-a-list-of-strings-occur-in-a-string
Score: 5
Category: basics