Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter FiveGeneral Functions (continued)

ConvertAddNewlines Function

Overview

The ConvertAddNewlines function adds newline characters to a string by replacing ASCII carriage return and new line characters. The primary purpose of the function is to convert strings for use in various Windows controls and within files.

Syntax/Parameters

Syntax

string = ConvertAddNewlines ( string data );

Parameters

data

A string.

Return Value

Returns a string with newline characters or an empty string on failure. Use the GetLastError function to retrieve error information.

Remarks

The ConvertAddNewlines function searches the string for ASCII carriage return characters (‘\r’) and new line (‘\n’) characters and replaces them with “\r\n”, which is commonly used in Windows. This is particularly useful when formatting a string for use in Windows dialog boxes and controls, where reconciling different styles of denoting line endings is important. Note that the ConvertAddNewlines function has a processing limitation of 2MB at a time and is therefore not optimal for converting line endings within files or large chunks of text. Additionally, the ReadLine function returns a line of a file irrespective of its line ending. 

If the 2MB buffer is exceeded, the GetLastError function will return ERROR_OVERFLOW.

Related Functions

Platform Support

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

Legato IDE, Legato Basic