Try this:
[EDIT] Just did a test on a 170k file - took ~4s to find a text string right near the end of the file.
I haven't really used banks before - there's probably a way of optimising this so that it works in a fraction of the time it currently takes.
[EDIT 2] Try it with debug off! Same test as above takes about 0.3s. :))
Bank = LoadFileToBank("Filename.txt") Result = FindTextInBank("some text",Bank) If Result = 0 Notify "String not found!" Else Notify "Result found at offset " + Result EndIf Function LoadFileToBank(Filename$) FILE = ReadFile(Filename) BankID = CreateBank(FileSize(Filename)) ReadBytes BankID,FILE,0,BankSize(BankID) CloseFile FILE Return BankID End Function Function FindTextInBank(Txt$,BankID,Start = 0) Ptr = Start Repeat T$ = Chr$(PeekByte(BankID,Ptr)) If T$ = Left$(Txt$,1) For N = 1 To Len(Txt$)-1 T$ = T$ + Chr$(PeekByte(BankID,Ptr+N)) If T$ = Txt$ Then Exit Next EndIf Ptr = Ptr + 1 Until Ptr >= BankSize(BankID) Or T$ = Txt$ If T$ = Txt$ Return Ptr Else Return False EndIf End FunctionIt works. Don't know how fast it is with big files though...
[EDIT] Just did a test on a 170k file - took ~4s to find a text string right near the end of the file.
I haven't really used banks before - there's probably a way of optimising this so that it works in a fraction of the time it currently takes.
[EDIT 2] Try it with debug off! Same test as above takes about 0.3s. :))