Remove - Maple Help

StringTools

 Select
 select characters from a string
 Remove
 remove characters from a string
 SelectRemove
 split a string into two according to a predicate

 Calling Sequence Select(p, s) Remove(p, s) SelectRemove(p, s)

Parameters

 p - Maple procedure that evaluates to either true or false; predicate that characters in the string must satisfy s - Maple string

Description

 • The Select( p, s ) function returns the characters in string s that satisfy the specified predicate p.
 • The first argument p must be a Maple procedure that returns either true or false. Procedure p is applied to each character in string s. The Select function returns the concatenation of all the characters from it for which the procedure p returns true.
 • The Remove( p, s ) function returns the characters in string s that do not satisfy the specified predicate p.
 • The first argument p must be a Maple procedure that returns either true or false. Procedure p is applied to each character in string s. The Remove function returns the concatenation of all the characters from it for which the procedure p returns false.
 • The SelectRemove( p, s ) function is equivalent to:

$\mathrm{SelectRemove}\left(p,s\right)=\left(\mathrm{Select}\left(p,s\right),\mathrm{Remove}\left(p,s\right)\right)$

 • If p returns a value other than true or false, an exception is raised.
 • These functions are part of the StringTools package, and so they can be used in the form Select(..) only after executing the command with(StringTools). However, they can always be accessed through the long form of the command by using the form StringTools[Select](..).
 Note: These functions are analogous to the select, remove, and selectremove functions.
 • 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

 > $\mathrm{with}\left(\mathrm{StringTools}\right):$
 > $\mathrm{Select}\left(\mathrm{IsUpper},\mathrm{Capitalize}\left("This is a test."\right)\right)$
 ${"TIAT"}$ (1)
 > $s≔\mathrm{Random}\left(1000\right):$
 > $t≔\mathrm{Select}\left(\mathrm{IsAlphaNumeric},s\right):$
 > $\mathrm{length}\left(s\right),\mathrm{length}\left(t\right)$
 ${1000}{,}{258}$ (2)
 > $\mathrm{Remove}\left(\mathrm{IsVowel},"Some people contend that in the English language vowels are superfluous."\right)$
 ${"Sm ppl cntnd tht n th nglsh lngg vwls r sprfls."}$ (3)
 > $\mathrm{SelectRemove}\left(\mathrm{IsUpper},\mathrm{Capitalize}\left("This is a test."\right)\right)$
 ${"TIAT"}{,}{"his s est."}$ (4)