Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
btpoole
Level 7

Search Text File For String

I am needing to search a text file and paras a line of text but have been unsuccessful. I have read the sdk for using the different methods like left, right, mid and even the ifRegex but with no positive results. I know the particular string of text but the location in the text file may vary. The text file could contain up to 130 lines. Once I am able to find the particular string I could use the left, right to extract the desired string. Can somebody tell me the easiest way to search the file for string.
Thanks for any help

The file is a tmp file on the roku.
0 Kudos
2 Replies
EnTerr
Level 8

Re: Search Text File For String

BrightScript Debugger> ? inStr(1, "some really big string coming from a file perhaps", "ring")
19

See 8.5 Instr(start as Integer, text as String, substring as String) as Integer
Also 7.7 ReadAsciiFile(filepath as String) as String
0 Kudos
btpoole
Level 7

Re: Search Text File For String

Thanks, was able to locate string with your help using instr.
0 Kudos