TStrings.LoadFromFile

Applies to TestComplete 15.70, last modified on December 17, 2024

Loads a list of strings from a specified file.

Declaration

TStringsObj.LoadFromFile(FileName) Parameters
TStringsObj     A TStrings object  
FileName [in] Required String
Result     Integer  

Description

Use the LoadFromFile method to fill the TStrings object with a list of strings from a specified file. This method first removes all strings from the list, and then populates the list with separate strings (delimited by new line symbols) from the file.

Parameters

The method has the following parameter:

FileName

The path to the file that contains the strings.

Remarks

Since LoadFromFile treats new line symbols as string separators, this method does not let you populate the list with strings that contain new line symbols.

If you need to populate the list with strings that contain new line symbols, you can use the following workaround. First, load the file contents to a variable, for example, using the aqFile.ReadWholeTextFile or aqTextFile.ReadAll method. To populate the list of strings, assign the loaded text to the CommaText or DelimitedText property. See these properties descriptions to learn the required text format.

See Also

TStrings.Add
TStrings.CommaText
TStrings.DelimitedText
TStrings.Insert
TStrings.SaveToFile
TStrings.Text

Highlight search results