Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter FiveGeneral Functions (continued)

ExpandTabs Function

Overview

The ExpandTabs function scans a string, locates tab characters (0x09), and expands the tabs with the specified character at the snap position.

Syntax/Parameters

Syntax

string = ExpandTabs ( string data, [int size], [char fill] );

Parameters

data

A source string containing the data to expand. The source cannot exceed 1,048,575 characters in size.

size

An optional int specifying the size of the tab stops. The value must be from 1 to 64. The default value is 8.

fill

An optional char specifying the character to use to replace/fill the tab area. If the fill is not a space, the tab character is not converted and the remaining stop area is filled with the fill character. The default value is space (0x20). See Remarks below.

Return Value

Returns a string with the adjusted data and tabs removed or an empty string on failure. Use the GetLastError function to retrieve error information.

Remarks

The ExpandTabs function is designed to perform two basic functions: expanding tabs and replacing them with spaces, and, expanding the tab area with a fill character. Replacing with spaces is effectively a method of making the string printable but the tab characters are lost and the string cannot be collapsed with tabs. The latter method allows for the character positions to be mapped correctly and the string to be collapsed after performing any desired actions.

Line-ending characters are accounted for in the process and will reset the tab stop position tracking to allow for the start of a new line.

Typically, the backspace character (0x08) is used as fill for collapsing. This character has no storage significance and is easily removed to restore the string.

Range errors on the size and fill parameters will result in a runtime error terminating the script.

The resulting string cannot exceed the maximum buffer size of 1,048,575. If it does, the GetLastError function will return ERROR_OVERFLOW.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic