Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter FiveGeneral Functions (continued)

CompareStrings Function

Overview

The CompareStrings function compares the value of the characters between two strings and returns a result as less than, equal to, or greater than.

Syntax/Parameters

Syntax

int = CompareStrings ( string a, string b );

Parameters

a

A string to compare.

b

A string to compare.

Return Value

Returns an int value as:

-1if a < b
0if a == b
1if a > b

Remarks

The CompareStrings function combines the basic comparison operators (==, <, and >) to allow string comparison in a single operation. The function compares a and b on a character by character basis. If all characters matchup between the strings up to the matching terminating /0 character, the return result is 0. If any character mismatches, the comparison is stopped and -1 or 1 is returned depending on whether the character in a is less than the character at the same position in b.

Except for the terminating zero (as is the case with string types), the CompareString function essentially performs a binary, character-for-character comparison.

 Related Functions

Platform Support

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

Legato IDE, Legato Basic