I am struggling a bit writing some code to search a field for a string. Basically, I have content being held in this field from a file that a user selected. I opened it, read it, and now I want to search it for "APPROVED NO". For each instance of "APPROVED NO" I find I want to put into a variable and count the number of instances. The end goal is to be able to use this program to say how many times a credit card transaction was rejected.
I know LiveCode's text manipulation ability is supposed to be easy and powerful but it confuses the hell out of me compared to using AutoIt.
Code: Select all
on mouseUp
answer file "Choose your STL file:"
put it into fld "Path" //this just shows the user the path they selected
open file(fld "Path") for read //open file
read from file (fld "Path") at 1 until EOF //read file
put it into fld "File" //put contents of file into field for user to see
end mouseUp
I know i need to use a loop so I was thinking about saying
Code: Select all
repeat for number of lines in fld "File"
...
end repeat
Thanks!