Is there a simple way to intersect two strings? I did not find anything about that.
intersect["abcdEfgh","blahcdEzz"] (* "cdE" *)
By intersection, I mean the longest substring(s) that is(are) common to both strings.
Is there a simple way to intersect two strings? I did not find anything about that.
intersect["abcdEfgh","blahcdEzz"] (* "cdE" *)
By intersection, I mean the longest substring(s) that is(are) common to both strings.
As porposed by @V.E. you should use LongestCommonSubsequence[s1,s2]
. Example from the documentation:
LongestCommonSubsequence[ "AAABBBBCCCCC", "CCCBBBAAABABA"]
(* AAAB *)