StringTools[Take] - extract a prefix from a string
StringTools[Drop] - remove a prefix from a string
|
Calling Sequence
|
|
Take( s, len )
Drop( s, len )
|
|
Parameters
|
|
s
|
-
|
Maple string
|
len
|
-
|
non-negative integer; length of prefix to extract or remove
|
|
|
|
|
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.
|
•
|
Take and Drop satisfy the equation
|
|
for all non-negative integers n.
|
|
|
Examples
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
|
|
Download Help Document
Was this information helpful?