StringTools
Group
separate a string into groups based on a property
Calling Sequence
Parameters
Description
Examples
Group(p, s)
p
-
a predicate ( Maple procedure) to apply to string s
s
string
The Group(p,s) function returns an expression sequence of consecutive substrings of s that are maximal with respect to the individual characters satisfying, or not satisfying, the predicate p.
This procedure is analogous to the Group procedure in the ListTools package.
If the input string s is the empty string, for example, Group(IsDigit, "") then NULL is returned; see the last example.
All of the StringTools package commands treat strings as (null-terminated) sequences of 8-bit (ASCII) characters. Thus, there is no support for multibyte character encodings, such as unicode encodings.
with⁡StringTools:
s≔Random⁡30,alnum
s≔y58KNhcGK09mxYYTx7RAPYLR9k1yzm
Group⁡IsDigit,s
y,58,KNhcGK,09,mxYYTx,7,RAPYLR,9,k,1,yzm
op⁡map⁡Join,ListTools:-Group⁡IsDigit,Explode⁡s,
Group⁡IsDigit,
See Also
ListTools[Group]
map
op
StringTools[Explode]
StringTools[IsDigit]
StringTools[Join]
StringTools[Split]
Download Help Document