Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter FiveGeneral Functions (continued)

Tabify Function

Overview

The Tabify function scans a string, locates groups of spaces that can be replaced with tab characters (0x09).

Syntax/Parameters

Syntax

string = Tabify ( string data, [int size], [int position], [dword mode] );

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 2 to 64. The default value is 8. If the value is not in range, 8 is assumed.

position

An optional int specifying the zero-based position to stop. When specified as not zero, this is the position where the processing will stop. If the value exceeds the size of the string, it is ignored.

mode

An optional dword specifying mode flags. The default is 0x00000000 or no flags. The only option is TABIFY_PROTECT_LITERALS which causes any area specified within single or double quotes to be excluded from processing.

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

Tabify begins by expanding any existing tabs into a uniform string and then walks backwards replacing tabs and spaces with uniform tabs at the interval size. Since the string is expanded prior to replacing spaces with tabs, the resulting string cannot exceed the maximum buffer size of 1,048,575. If it does, the GetLastError function will return ERROR_OVERFLOW.

The processing replaces 2 or more spaces with tabs at each interval position as specified by the size parameter. Depending on the application, it may be desirable to not processes string literal values inside of quotes. To direct the process to exclude such areas, use the TABIFY_PROTECT_LITERALS option in the mode parameter.

Related Functions

Platform Support

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

Legato IDE, Legato Basic