Return text from file - first instance only

(imported topic written by SystemAdmin)

I have some code which will return some text (version number) but unfortunately there is more than one instance of “Version=” in the text file. How can I get the first instance only?

My current code which returns multiple results:

following texts of firsts “Version=” of lines whose (it starts with “Version=”) of file “C:\blah.ini” as string

Sample blah.ini:

Version=123

Version=345

I want to return “123”

thanks

(imported comment written by SystemAdmin)

Give this a try

following text of first "Version=" of preceding text of first ";:;" of concatenation ";:;" of lines whose (it starts with "Version=") of file  "C:\blah.ini"

(imported comment written by jessewk)

We actually have dedicated inspectors for parsing INI files. I’m guessing there is only one ‘version’ key for each ‘section’ (where a section is denoted by a header with the format:

sectionname

). If so, you’ll find the following much more efficient and also easier to read:

key “version” of section “section name” of file “c:\blah.ini”

Jesse