Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Select characters from strings
ResourceFunction["StringSelect"][str,crit] picks out all characters of str for which crit[ci] is True. | |
ResourceFunction["StringSelect"][str,crit→prop] returns the property prop of the selected elements. | |
ResourceFunction["StringSelect"][str,crit,n] picks out the first n elements for which crit[ei] is True. | |
ResourceFunction["StringSelect"][crit] represents an operator form of StringSelect that can be applied to an expression. |
"Element" | the selected characters |
"Index" | indices of the selected characters |
"BitVectorMask" | Boolean mask returning True for selected values and False otherwise |
{prop1,prop2} | a list of multiple forms |
All | an association giving element, index and bit vector mask |
Select only the letters from a sample of the United States Declaration of Independence:
In[1]:= | ![]() |
Out[2]= | ![]() |
Select only vowels from a sample of the United States Declaration of Independence:
In[3]:= | ![]() |
Out[5]= | ![]() |
Select only upper case letters from a sample of the United States Declaration of Independence:
In[6]:= | ![]() |
Out[7]= | ![]() |
Select punctuation from a sample of the United States Declaration of Independence:
In[8]:= | ![]() |
Out[10]= | ![]() |
Use the operator form:
In[11]:= | ![]() |
Out[11]= | ![]() |
Get the indices of upper case letters:
In[12]:= | ![]() |
Out[13]= | ![]() |
Wolfram Language 13.0 (December 2021) or above
This work is licensed under a Creative Commons Attribution 4.0 International License