separate a string into groups based on a property - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Names and Strings : StringTools Package : Miscellaneous Utilities : StringTools/Group

StringTools[Group] - separate a string into groups based on a property

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 last example.

Examples

withStringTools:

s:=Random30,'alnum'

s:=y58KNhcGK09mxYYTx7RAPYLR9k1yzm

(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]


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam