Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Get character permutations for a string
ResourceFunction["StringPermutations"][string] generates a list of all possible permutations of the characters in string. | |
ResourceFunction["StringPermutations"][string,n] gives all permutations containing at most n characters. | |
ResourceFunction["StringPermutations"][string,{n}] gives all permutations containing exactly n characters. |
Permutations of "cat":
In[1]:= |
Out[1]= |
Three character permutations of "horse":
In[2]:= |
Out[2]= |
Zero, one, two and three character permutations of "garden":
In[3]:= |
Out[3]= |
StringPermutations can also be implemented with the resource function StringFunction:
In[4]:= |
Out[4]= |
In[5]:= |
Out[5]= |
In[6]:= |
Out[6]= |
This work is licensed under a Creative Commons Attribution 4.0 International License