You can split the strings into two arrays
a = "sun is clear".splitb = "sun cloud rain".splitand compute the intersection
a & b# => ["sun"] (a & b).empty?# => falseIf the intersection is not empty, then they share pieces. Otherwise, you can also compute the difference of a - b
(a - b).size == a.size# => false
ليست هناك تعليقات:
إرسال تعليق