Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter FiveGeneral Functions (continued)

GetStringSegment Function

Overview

The GetStringSegment function returns a segment of a string as defined by a starting position and an optional size.

Syntax/Parameters

Syntax

string = GetStringSegment ( string source, int position, [int size] );

wstring = GetStringSegment ( wstring source, int position, [int size] );

Parameters

source

A string or a wstring from which to get a string segment. The source data type directs the result data type.

position

An int position, counting from zero, at which the string segment begins.

size

An int containing optional number of characters to return. If omitted, the remainder of the source string is returned.

Return Value

Returns a string or a wstring containing the segment of source from position or an empty string on failure. Use the GetLastError function to retrieve error information.

Remarks

If position was beyond the end of the source string or position is in range but when added to the requested size it exceeds the length of the source string, the GetLastError function will return ERROR_RANGE.

The returned string is not trimmed for spaces and is returned verbatim. Tabs are counted as single characters. Use the tab expansion and compression functions (the ExpandTabs and CollapseTabs functions) to deal with realized tab positions.

Related Functions

Platform Support

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

Legato IDE, Legato Basic