StringTools
SubString
extract a substring from a string
Calling Sequence
Parameters
Description
Examples
SubString( s, r )
s
-
Maple string
r
range; specifies what substring to extract
The SubString(s, r) command returns a substring of string s specified by range r. A substring is a sequence of characters that occurs contiguously in the original string from which it is selected.
The range r must have integer endpoints. Range indexing for this function is similar to substring selection via the sa..b notation. For more information about range indexing, see selection.
The main difference between Substring and the Maple built-in substring procedure is that, when passed a symbol as the first argument, substring returns a symbol by default, whereas SubString always returns a string.
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.
with⁡StringTools:
SubString⁡abcdef,2..2
b
SubString⁡abcdef,3..5
cde
SubString⁡abcdef,−5..−3
bcd
See Also
selection
string
StringTools[Drop]
StringTools[Map]
StringTools[Select]
StringTools[Take]
substring
type[string]
type[symbol]
Download Help Document