 ExpandTabs - Maple Help

StringTools

 ExpandTabs
 expand tabs to specified tab stops Calling Sequence ExpandTabs( s, tabs ) Parameters

 s - Maple string; string to be expanded tabs - {posint,list(posint)}; (optional) tab stop specification Description

 • 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 $[\mathrm{n1},\mathrm{n2},...,\mathrm{nk}]$, then tabs are set at columns $\mathrm{n1}$, $\mathrm{n2}$, ..., and $\mathrm{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. Examples

 > $\mathrm{with}\left(\mathrm{StringTools}\right):$
 > $\mathrm{ExpandTabs}\left("a\tb\tc\td\te"\right)$
 ${"a b c d e"}$ (1)
 > $\mathrm{ExpandTabs}\left("a\tb\tc\td\te",8\right)$
 ${"a b c d e"}$ (2)
 > $\mathrm{ExpandTabs}\left("a\tb\tc\td\te",4\right)$
 ${"a b c d e"}$ (3)
 > $\mathrm{ExpandTabs}\left("a\tb\tc\td\te",\left[2,4,8,16,32,64\right]\right)$
 ${"a b c d e"}$ (4)
 > $\mathrm{ExpandTabs}\left("a\tb\tc\td\te",\left[2,4,8\right]\right)$
 ${"a b c d e"}$ (5)
 > $\mathrm{ExpandTabs}\left("a\tb\tc\nd\te",\left[2,4,8,16,32,64\right]\right)$
 ${"a b c d e"}$ (6)

The following are errors because the lists of tab stops are not strictly increasing.

 > $\mathrm{ExpandTabs}\left("a\tb\tc\td\te",\left[2,8,4\right]\right)$
 > $\mathrm{ExpandTabs}\left("a\tb\tc\td\te",\left[2,8,8\right]\right)$