Wolfram Research

Function Repository Resource:

StringOverlapsQ

Source Notebook

Test whether a string or strings have overlaps

Contributed by: Stephen Wolfram

ResourceFunction["StringOverlapsQ"][{string1,string2,}]

gives True if there are overlaps between the stringi, or False otherwise.

ResourceFunction["StringOverlapsQ"][string]

gives True if there are self-overlaps in string, or False otherwise.

Examples

Basic Examples

This string cannot overlap itself:

In[1]:=
ResourceFunction["StringOverlapsQ"]["AABB"]
Out[1]=

But this string can:

In[2]:=
ResourceFunction["StringOverlapsQ"]["AABA"]
Out[2]=

These strings have no mutual or self-overlaps:

In[3]:=
ResourceFunction["StringOverlapsQ"][{"AAABBB", "AABBAB"}]
Out[3]=

But these do:

In[4]:=
ResourceFunction["StringOverlapsQ"][{"AAABBA", "AABBAB"}]
Out[4]=

Resource History

Related Resources

License Information