Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter FiveGeneral Functions (continued)

GetWordCount Function

Overview

The GetWordCount function returns the number of words or items in a string.

Syntax/Parameters

Syntax

int = GetWordCount ( string data,  [dword flags] );

int = GetWordCount ( wstring data, [dword flags] );

Parameters

data

A string or wstring specifying the source data. The source type dictates the return type.

flags

An optional dword specifying the parse options. If omitted, the value is WP_GENERAL. The flag values are as follows.

  WP_GENERAL 0 General – stops on word spaces.
  WP_SGML_TAG 1 Tags – stops on tags (SGML, HTML, and XML).
  WP_PROGRAM 2 Program – stops on typical programmatic expressions.
  WP_PROGRAM_GROUP 3 Program Groups – same as mode 2 but returns complete groups for parenthesis (‘( )’), brackets (‘[ ]’), single quotes (‘ ' ' ’), and double quotes (‘ " " ’).
  WP_OBJECT_NOTATION 5 Object Notation — Stops on delimiters commonly used on object references such as ‘.’ ‘[‘ and ‘]’.

 

Return Value

Returns an int containing the number of words. If the string contains a word larger than the internal buffer, an overflow will be set. Use the GetLastError() function to retrieve the error and count or the IsError function to determine if an error occurred.

Remarks

The GetWordCount function encapsulates the Word Parse Object and counts the number of parsed items in the source string data.

The internal word buffer is limited to 4096 characters. Should a parsed string item be larger, the function will with an overflow error. If the source cannot be controlled, it is best to use the GetLastError or IsError function to determine if an internal overflow occurred.

Related Functions

Platform Support

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

Legato IDE, Legato Basic

Page revised 2024-12-13