StringTools
ExpandTabs
expand tabs to specified tab stops
Calling Sequence
Parameters
Description
Examples
ExpandTabs( s, tabs )
s
-
Maple string; string to be expanded
tabs
{posint,list(posint)}; (optional) tab stop specification
The procedure ExpandTabs replaces tab characters in a string with spaces according to a given tab stop specification.
The tab stop specification must be either a positive integer, or a strictly increasing list of positive integers. If the tab stop is a positive integer n, then tabs are set every n columns. If the tab stop specification is a list [⁢n1,n2,...,nk⁢], then tabs are set at columns n1, n2, ..., and nk. The default value for the optional second argument is the positive integer 8.
A string is returned in which tabs in the original input string s have been replaced by spaces to the indicated tab stops; the input string is not modified.
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:
ExpandTabs⁡a\tb\tc\td\te
a b c d e
ExpandTabs⁡a\tb\tc\td\te,8
ExpandTabs⁡a\tb\tc\td\te,4
ExpandTabs⁡a\tb\tc\td\te,2,4,8,16,32,64
ExpandTabs⁡a\tb\tc\td\te,2,4,8
ExpandTabs⁡a\tb\tc\nd\te,2,4,8,16,32,64
The following are errors because the lists of tab stops are not strictly increasing.
ExpandTabs⁡a\tb\tc\td\te,2,8,4
Error, (in StringTools:-ExpandTabs) tab stops must be strictly increasing
ExpandTabs⁡a\tb\tc\td\te,2,8,8
See Also
string
Download Help Document