Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter FiveGeneral Functions (continued)

InString Function

Overview

The InString function will search a target string for a matching string or character and return its position. This function allows searching for a specific character.

Syntax/Parameters

Syntax

int = InString ( string source, mixed value, [boolean case] );

int = InString ( wstring source, mixed value, [boolean case] );

Parameters

source

A string in which to search for target.

value

A target string; or,

a target char. The character can be any type that will resolve to an integer.

case

A boolean flag indicating whether to perform the search in a case-sensitive manner. The default is a TRUE indicating a case-sensitive search.

Return Value

Returns an int containing the zero-based starting position within source where target was found (case-sensitive) or -1 on failure. Use the GetLastError function to retrieve error information.

Remarks

The InString function provides a method of determining the starting position of a character or string segment within a source string. For a looser matching method, use the FindInString function, but note that the FindInString function does not permit searching for a specific character. This makes the InString function a better choice for searching for a delimiter or a specific item within a string. A boolean version of this function is available as the IsInString function.

If value is not found within source, the GetLastError function will return -1.

Case-insensitive matching is performed on a locale basis as set by Windows. For US, on ASCII, matching is the only case matching performed.

If the value is a string and the string is empty, the result is always -1.

Related Functions

Platform Support

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

Legato IDE, Legato Basic

Page revised 2024-12-13