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

Online Help

All Products    Maple    MapleSim


StringTools

  

Take

  

extract a prefix from a string

  

Drop

  

remove a prefix from a string

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

Take( s, len )

Take( s, delim )

Drop( s, len )

Drop( s, delim )

Parameters

s

-

Maple string

len

-

non-negative integer; length of prefix to extract or remove

delim

-

string; set of characters (delimiters)

Description

• 

The Take(s, len) command returns the prefix of length len from string s.

  

If s has at least len characters, then the substring of s consisting of the first len characters of s is returned. That is, the string  is returned. If s has length less than len, then s is returned.

• 

The Drop(s, len) command removes the prefix of length len from string s.

  

If the length of s is greater than or equal to len, then the string  is returned. If the length of s is less than len, then an empty string is returned.

• 

If the second argument is a string delim, it is interpreted as a set of delimiting characters. In this case, the Take( s, delim ) command returns the prefix of s consisting of characters not in the string delim. The Drop( s, delim ) command returns the suffix of s consisting of characters not in the string delim.

• 

Take and Drop satisfy the equation

  

for all non-negative integers n.

• 

All of the StringTools package commands treat strings as (null-terminated) sequences of -bit (ASCII) characters.  Thus, there is no support for multibyte character encodings, such as unicode encodings.

Examples

(1)

(2)

(3)

(4)

(5)

(6)

(7)

See Also

cat

seq

string

StringTools

StringTools[IsPrefix]

StringTools[Join]

StringTools[Split]

StringTools[SubString]

 


Download Help Document