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

Online Help

All Products    Maple    MapleSim


StringTools

  

ExpandTabs

  

expand tabs to specified tab stops

 

Calling Sequence

Parameters

Description

Examples

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 [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.

Examples

withStringTools:

ExpandTabsa\tb\tc\td\te

a b c d e

(1)

ExpandTabsa\tb\tc\td\te,8

a b c d e

(2)

ExpandTabsa\tb\tc\td\te,4

a b c d e

(3)

ExpandTabsa\tb\tc\td\te,2,4,8,16,32,64

a b c d e

(4)

ExpandTabsa\tb\tc\td\te,2,4,8

a b c d e

(5)

ExpandTabsa\tb\tc\nd\te,2,4,8,16,32,64

a b c d e

(6)

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

ExpandTabsa\tb\tc\td\te,2,8,4

Error, (in StringTools:-ExpandTabs) tab stops must be strictly increasing

ExpandTabsa\tb\tc\td\te,2,8,8

Error, (in StringTools:-ExpandTabs) tab stops must be strictly increasing

See Also

string

StringTools