StringTools - Maple Programming Help

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

StringTools

 Delete
 delete a segment of a string

 Calling Sequence Delete( s, rng )

Parameters

 s - string; a Maple string rng - range of characters to delete

Description

 • The Delete(s,rng) command removes a segment of a string s, specified by the second argument rng.
 • The range argument rng must specify a valid range of characters in the string s, unless the string s is empty. If s is the empty string, then the empty string is returned in all cases, no matter how the range is specified.
 • When the endpoints of rng are equal, a single character of the non-empty string s is removed.
 • Note that Delete( s, 1 .. length( s ) ) (or, equivalently, Delete( s, 1 .. -1 )) returns the empty string $""$.

Examples

 > $\mathrm{with}\left(\mathrm{StringTools}\right):$
 > $\mathrm{Delete}\left("abcde",2..3\right)$
 ${"ade"}$ (1)
 > $\mathrm{Delete}\left("abcde",4..4\right)$
 ${"abce"}$ (2)
 > $\mathrm{Delete}\left("abcde",2..-2\right)$
 ${"ae"}$ (3)
 > $\mathrm{Delete}\left("abcde",2..7\right)$
 ${"a"}$ (4)
 > $\mathrm{Delete}\left("",1..-1\right)$
 ${""}$ (5)
 > $\mathrm{Delete}\left("",98..43\right)$
 ${""}$ (6)
 > $\mathrm{Delete}\left("",5..5\right)$
 ${""}$ (7)