Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Use functions meant for lists on strings
| ResourceFunction["StringFunction"][f][string,…] applies f to the characters in string. | 
Use a function meant for lists on a string:
| In[1]:= | ![ResourceFunction["StringFunction"][Reverse]["Hello World"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/38597f2051ee187e.png) | 
| Out[1]= |  | 
Create new string functions from existing functions:
| In[2]:= | ![MyStringSelect = ResourceFunction["StringFunction"][Select]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/477137f7ca5dd081.png) | 
| Out[2]= |  | 
| In[3]:= | ![MyStringSelect["Hello World", LowerCaseQ]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/553568a62012da4b.png) | 
| Out[3]= |  | 
Rotate a string:
| In[4]:= | ![ResourceFunction["StringFunction"][RotateLeft]["Hello World"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/242f9d014b54836d.png) | 
| Out[4]= |  | 
| In[5]:= | ![ResourceFunction["StringFunction"][RotateRight]["Hello World"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/24755ac36dd586e6.png) | 
| Out[5]= |  | 
Get a random permutation of a string:
| In[6]:= | ![ResourceFunction["StringFunction"][RandomSample]["Hello World"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/501c20ddabd69f48.png) | 
| Out[6]= |  | 
Replace all vowels:
| In[7]:= | ![ResourceFunction["StringFunction"][
  ReplaceAll["a" | "e" | "i" | "o" | "u" -> "X"]]["Hello World"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/7f81cf0f039ceee0.png) | 
| Out[7]= |  | 
Insert spaces between each letter:
| In[8]:= | ![ResourceFunction["StringFunction"][StringRiffle]["Hello World"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/71fca435f778f659.png) | 
| Out[8]= |  | 
More examples for StringFunction:
| In[9]:= | ![ResourceFunction["StringFunction"][Delete]["abcde", 3]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/1dea2caa17dc4dc8.png) | 
| Out[9]= |  | 
| In[10]:= | ![ResourceFunction["StringFunction"][Drop]["don't do it!", 6]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/01712fe275446e7a.png) | 
| Out[10]= |  | 
| In[11]:= | ![ResourceFunction["StringFunction"][Union]["this is a string"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/05df0575402bc3a9.png) | 
| Out[11]= |  | 
| In[12]:= | ![ResourceFunction["StringFunction"][
  DeleteDuplicates]["this is a string"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/670cfaf54737e65e.png) | 
| Out[12]= |  | 
| In[13]:= | ![ResourceFunction["StringFunction"][Sort]["this is a string"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/3a2b89bd7d1a11b5.png) | 
| Out[13]= |  | 
| In[14]:= | ![ResourceFunction["StringFunction"][Permutations]["abcd"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/080142122260bbfa.png) | 
| Out[14]= |  | 
| In[15]:= | ![ResourceFunction["StringFunction"][Subsets]["string"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/13866f9aa52676bc.png) | 
| Out[15]= |  | 
| In[16]:= | ![ResourceFunction["StringFunction"][Gather]["this is a string"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/488bfedeabdcf199.png) | 
| Out[16]= |  | 
Functions created by StringFunction behave as though they were Listable:
| In[17]:= | ![MyStringReverse = ResourceFunction["StringFunction"][Reverse]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/6305540537388527.png) | 
| Out[17]= |  | 
| In[18]:= | ![MyStringReverse[{"cat", "dog", "fish", "coelenterate"}]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/7046c3392dd593f7.png) | 
| Out[18]= |  | 
This is similar to many of the built-in string functions:
| In[19]:= | ![StringReverse[{"cat", "dog", "fish", "coelenterate"}]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/08ad2d19b11f5034.png) | 
| Out[19]= |  | 
Use a custom function in StringFunction:
| In[20]:= | ![randomStartsWith[c_] := RandomChoice[DictionaryLookup[c ~~ __]] <> "! ";
standsFor = Row[{#, " stands for:\n", ResourceFunction["StringFunction"][Map[randomStartsWith]][#]}] &](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/424e16325faa50b2.png) | 
| Out[18]= |  | 
| In[21]:= | ![standsFor["string"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/66df48592e6c2522.png) | 
| Out[21]= |  | 
If the given function produces nested lists of strings, the list structure will be preserved:
| In[22]:= | ![ResourceFunction["StringFunction"][Outer[List, #, #] &]["ooer!"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/75316c33b8c53fc8.png) | 
| Out[22]= |  | 
Characters are separated using Characters instead of byte values, so encoding is preserved:
| In[23]:= | ![ResourceFunction["StringFunction"][StringRiffle@*CharacterName]["猫鳥犬"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/47c293af4988fdaf.png) | 
| Out[23]= |  | 
The given function is applied to a list of strings:
| In[24]:= | ![ResourceFunction["StringFunction"][ToString@*ListQ]["Hello World"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/35357682f7a47ac8.png) | 
| Out[24]= |  | 
| In[25]:= | ![ResourceFunction["StringFunction"][ToString@*StringQ]["Hello World"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/2c031b0900173bf7.png) | 
| Out[25]= |  | 
StringFunction applies f to Characters["string"] and joins the result:
| In[26]:= | ![ResourceFunction["StringFunction"][Echo]["Hello World"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/3aee3fc3a0ffd652.png) | 

| Out[26]= |  | 
| In[27]:= | ![ResourceFunction["StringFunction"][Map[Echo]]["abc"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/67f53fcba0aaeb48.png) | 



| Out[27]= |  | 
The given f must produce a string or lists of strings from its output:
| In[28]:= | ![ResourceFunction["StringFunction"][ToCharacterCode]["abc"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/45124c70776a8797.png) | 
| Out[28]= |  | 
| In[29]:= | ![ResourceFunction["StringFunction"][
  StringRiffle@*Map[ToString]@*Flatten@*ToCharacterCode]["abc"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/1e9ad22d9d4c54d6.png) | 
| Out[29]= |  | 
Validity is not determined until evaluation of StringFunction[…][args]:
| In[30]:= | ![f = ResourceFunction["StringFunction"][invalid]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/185f2c650fc1340b.png) | 
| Out[30]= |  | 
| In[31]:= | ![f["oh no!"]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/6c326ec95741b531.png) | 
| Out[31]= |  | 
Create a scrolling marquee to experience that ‘90s website nostalgia:
| In[32]:= | ![scroll[text_String] := ListAnimate[
   NestList[ResourceFunction["StringFunction"][RotateLeft], text <> " ", StringLength[text]]];](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/0706c6cb9b317a9a.png) | 
| In[33]:= | ![Style[scroll["Welcome to my website about cats!"], FontFamily -> "Comic Sans MS", FontSize -> 24, FontColor -> Purple]](https://www.wolframcloud.com/obj/resourcesystem/images/3ee/3eed9d35-ae58-446f-8218-bac86b902e83/3feef2b9b917d18e.png) | 
| Out[33]= |  | 
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License