Wolfram Computation Meets Knowledge

StringUnion

Contributed by: Arnoud Buzing

Find the distinct characters in multiple strings

ResourceFunction["StringUnion"][s1,s2,]

gives a string containing all the distinct characters in any of the si.

Details and Options

Characters in the returned string are sorted in standard order.

Examples

Basic Examples

Find characters in one string that are also another:

In[1]:=
ResourceFunction["StringUnion"]["Hello", "World"]
Out[1]=

Scope

Use several strings:

In[2]:=
ResourceFunction[
 "StringUnion"]["Which of the characters are distinct?", "Some of \
these", "And some of these", "Don't forget these"]
Out[2]=

All characters are supported:

In[3]:=
{str1, str2} = TextCases[ResourceData["The Odyssey - Greek"], "Sentence"][[1 ;; 2]]
Out[3]=
In[4]:=
ResourceFunction["StringUnion"][str1, str2]
Out[4]=

Resource History