Forum Discussion
HKosova
Alumni
14 years agoHi Stephane,
Basically, you need to split the string by the new line character and then iterate through individual items in the resulting array. For example:
You can also loop through the text using TestComplete's aqString.GetListItem object if you set aqString.ListSeparator to the new line character ("\r\n" in JScript, vbNewLine constant in VBScript or #13#10 in DelphiScript). Have a look at examples in the linked topics.
By the way, your file looks similar to an INI file, only with a non-standard separator for name-value pairs.
If you could modify your file into:
; NB: The Root section is mandatory
[Root]
[Control1]
Caption='hello'
With=12
Height=22
[Control333]
Caption='hello'
With=12
Height=22
you'd be able to access the sections and name-value pairs using TestComplete's Storages.INI API, instead of manually parsing the file.
Basically, you need to split the string by the new line character and then iterate through individual items in the resulting array. For example:
var arr = str.split("\r\n");
for (var i = 0; i < arr.length; i++)
{
// Do something with arr
}
You can also loop through the text using TestComplete's aqString.GetListItem object if you set aqString.ListSeparator to the new line character ("\r\n" in JScript, vbNewLine constant in VBScript or #13#10 in DelphiScript). Have a look at examples in the linked topics.
By the way, your file looks similar to an INI file, only with a non-standard separator for name-value pairs.
If you could modify your file into:
; NB: The Root section is mandatory
[Root]
[Control1]
Caption='hello'
With=12
Height=22
[Control333]
Caption='hello'
With=12
Height=22
you'd be able to access the sections and name-value pairs using TestComplete's Storages.INI API, instead of manually parsing the file.