Group - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


StringTools

  

Group

  

separate a string into groups based on a property

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

Group(p, s)

Parameters

p

-

a predicate ( Maple procedure) to apply to string s

s

-

string

Description

• 

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.

Examples

withStringTools:

sRandom30,alnum

sy58KNhcGK09mxYYTx7RAPYLR9k1yzm

(1)

GroupIsDigit,s

y,58,KNhcGK,09,mxYYTx,7,RAPYLR,9,k,1,yzm

(2)

opmapJoin,ListTools:-GroupIsDigit,Explodes,

y,58,KNhcGK,09,mxYYTx,7,RAPYLR,9,k,1,yzm

(3)

GroupIsDigit,

See Also

ListTools[Group]

map

op

string

StringTools

StringTools[Explode]

StringTools[IsDigit]

StringTools[Join]

StringTools[Split]